summaryrefslogtreecommitdiffstats
path: root/source/lib/socket/socket_unix.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-28 07:34:11 +0000
committerAndrew Tridgell <tridge@samba.org>2004-10-28 07:34:11 +0000
commit2b1a24fac0792dc8e24ccc1d19cbbba23e2a8ea6 (patch)
treed9f33a72c3ed6b34f1afd272677104c9625816cd /source/lib/socket/socket_unix.c
parent5adef7a738a0c988371855cee431ad673979a135 (diff)
downloadsamba-2b1a24fac0792dc8e24ccc1d19cbbba23e2a8ea6.tar.gz
samba-2b1a24fac0792dc8e24ccc1d19cbbba23e2a8ea6.tar.xz
samba-2b1a24fac0792dc8e24ccc1d19cbbba23e2a8ea6.zip
r3313: in socket_accept() make the new socket non-blocking unless SOCKET_FLAG_BLOCK is set.
Diffstat (limited to 'source/lib/socket/socket_unix.c')
-rw-r--r--source/lib/socket/socket_unix.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/lib/socket/socket_unix.c b/source/lib/socket/socket_unix.c
index 3a3ce5fe8af..239e4eb0694 100644
--- a/source/lib/socket/socket_unix.c
+++ b/source/lib/socket/socket_unix.c
@@ -136,6 +136,14 @@ static NTSTATUS unixdom_accept(struct socket_context *sock,
return unixdom_error(errno);
}
+ if (!(flags & SOCKET_FLAG_BLOCK)) {
+ int ret = set_blocking(new_fd, False);
+ if (ret == -1) {
+ close(new_fd);
+ return map_nt_error_from_unix(errno);
+ }
+ }
+
(*new_sock) = talloc_p(NULL, struct socket_context);
if (!(*new_sock)) {
close(new_fd);