X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fnetwork%2Fsocket.c;h=a2e92d908265651a02e8e7bf544ea2dcd2e7ea82;hb=7b712844e38bdfc1ef728e257fb8616c16ec4cc8;hp=ba8d45b16403d991ffe2a6e3fa02d9440bc7b529;hpb=79a5e73e518213d5e77a06cfc0db74ffbf7922c6;p=musl diff --git a/src/network/socket.c b/src/network/socket.c index ba8d45b1..a2e92d90 100644 --- a/src/network/socket.c +++ b/src/network/socket.c @@ -6,15 +6,16 @@ int socket(int domain, int type, int protocol) { int s = socketcall(socket, domain, type, protocol, 0, 0, 0); - if (s<0 && errno==EINVAL && (type&(SOCK_CLOEXEC|SOCK_NONBLOCK))) { + if (s<0 && (errno==EINVAL || errno==EPROTONOSUPPORT) + && (type&(SOCK_CLOEXEC|SOCK_NONBLOCK))) { s = socketcall(socket, domain, type & ~(SOCK_CLOEXEC|SOCK_NONBLOCK), protocol, 0, 0, 0); if (s < 0) return s; if (type & SOCK_CLOEXEC) - fcntl(s, F_SETFD, FD_CLOEXEC); + __syscall(SYS_fcntl, s, F_SETFD, FD_CLOEXEC); if (type & SOCK_NONBLOCK) - fcntl(s, F_SETFL, fcntl(s, F_GETFL) | O_NONBLOCK); + __syscall(SYS_fcntl, s, F_SETFL, O_NONBLOCK); } return s; }