r7476: ensure dgram sockets are created non-blocking. As they usually skip
authorAndrew Tridgell <tridge@samba.org>
Sat, 11 Jun 2005 02:26:53 +0000 (02:26 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:57 +0000 (13:17 -0500)
the connect() stage, we were missing this
(This used to be commit f5102b886c10fead0f6bcdc4460584ae53912ebc)

source4/lib/socket/socket.c

index dd3175468d50304942c6b050f3458c58cb519b35..39379be67872ea44202eb533635f1d08de237f73 100644 (file)
@@ -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;