diff options
-rw-r--r-- | socket.c | 11 | ||||
-rw-r--r-- | tests/014/socket-misc.tl | 4 |
2 files changed, 9 insertions, 6 deletions
@@ -1107,9 +1107,9 @@ static val open_socket(val family, val type, val mode_str) uw_ethrowf(socket_error_s, lit("~a failed: ~d/~s"), self, num(errno), errno_to_str(errno), nao); -#if SOCK_NONBLOCK || SOCK_CLOEXEC - type = num_fast(c_num(type, self) & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)); -#endif + if (SOCK_NONBLOCK || SOCK_CLOEXEC) + type = num_fast(c_num(type, self) & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)); + return open_sockfd(num(fd), family, type, mode_str, self); } @@ -1126,9 +1126,8 @@ static val socketpair_wrap(val family, val type, val mode_str) uw_ethrowf(socket_error_s, lit("~a failed: ~d/~s"), self, num(errno), errno_to_str(errno), nao); -#if SOCK_NONBLOCK || SOCK_CLOEXEC - type = num_fast(c_num(type, self) & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)); -#endif + if (SOCK_NONBLOCK || SOCK_CLOEXEC) + type = num_fast(c_num(type, self) & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)); { val s0 = open_sockfd(num(sv[0]), family, type, mode_str, self); diff --git a/tests/014/socket-misc.tl b/tests/014/socket-misc.tl new file mode 100644 index 00000000..39045c1d --- /dev/null +++ b/tests/014/socket-misc.tl @@ -0,0 +1,4 @@ +(load "../common") + +(with-stream (s (open-socket af-inet (logior sock-dgram sock-nonblock))) + (test (sock-listen s) t)) |