summaryrefslogtreecommitdiff
path: root/source4/lib/socket
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-11 02:26:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:57 -0500
commitb1b134084f96ba0765241091c47c6187f57f9867 (patch)
tree8f5da59bc91fadf3185ad144051c49bdfcf86f02 /source4/lib/socket
parent2514f8925e67bfd20fc0e2c17d0d1797f5b74f23 (diff)
downloadsamba-b1b134084f96ba0765241091c47c6187f57f9867.tar.gz
samba-b1b134084f96ba0765241091c47c6187f57f9867.tar.bz2
samba-b1b134084f96ba0765241091c47c6187f57f9867.zip
r7476: ensure dgram sockets are created non-blocking. As they usually skip
the connect() stage, we were missing this (This used to be commit f5102b886c10fead0f6bcdc4460584ae53912ebc)
Diffstat (limited to 'source4/lib/socket')
-rw-r--r--source4/lib/socket/socket.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c
index dd3175468d..39379be678 100644
--- a/source4/lib/socket/socket.c
+++ b/source4/lib/socket/socket.c
@@ -69,6 +69,12 @@ static NTSTATUS socket_create_with_ops(TALLOC_CTX *mem_ctx, const struct socket_
(*new_sock)->flags |= SOCKET_FLAG_TESTNONBLOCK;
}
+ /* we don't do a connect() on dgram sockets, so need to set
+ non-blocking at socket create time */
+ if (!(flags & SOCKET_FLAG_BLOCK) && type == SOCKET_TYPE_DGRAM) {
+ set_blocking(socket_get_fd(*new_sock), False);
+ }
+
talloc_set_destructor(*new_sock, socket_destructor);
return NT_STATUS_OK;