summaryrefslogtreecommitdiffstats
path: root/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/socket.c b/socket.c
index 571dad2f..2de2204e 100644
--- a/socket.c
+++ b/socket.c
@@ -1094,6 +1094,12 @@ static val open_socket(val family, val type, val mode_str)
{
val self = lit("open-socket");
int fd = socket(c_num(family, self), c_num(type, self), 0);
+#ifdef SOCK_NONBLOCK
+ type = logand(type, lognot(num_fast(SOCK_NONBLOCK), nil));
+#endif
+#ifdef SOCK_CLOEXEC
+ type = logand(type, lognot(num_fast(SOCK_CLOEXEC), nil));
+#endif
return open_sockfd(num(fd), family, type, mode_str, self);
}
@@ -1110,6 +1116,13 @@ static val socketpair_wrap(val family, val type, val mode_str)
uw_throwf(socket_error_s, lit("~a failed: ~d/~s"),
self, num(errno), errno_to_str(errno), nao);
+#ifdef SOCK_NONBLOCK
+ type = logand(type, lognot(num_fast(SOCK_NONBLOCK), nil));
+#endif
+#ifdef SOCK_CLOEXEC
+ type = logand(type, lognot(num_fast(SOCK_CLOEXEC), nil));
+#endif
+
{
val s0 = open_sockfd(num(sv[0]), family, type, mode_str, self);
val s1 = open_sockfd(num(sv[1]), family, type, mode_str, self);