projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
properly handle point-to-point interfaces in getifaddrs()
[musl]
/
src
/
network
/
socket.c
diff --git
a/src/network/socket.c
b/src/network/socket.c
index
ba8d45b
..
a2e92d9
100644
(file)
--- 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);
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)
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)
if (type & SOCK_NONBLOCK)
-
fcntl(s, F_SETFL, fcntl(s, F_GETFL) |
O_NONBLOCK);
+
__syscall(SYS_fcntl, s, F_SETFL,
O_NONBLOCK);
}
return s;
}
}
return s;
}