s3-prefork: Listening fds must be in non-blocking mode
authorSimo Sorce <idra@samba.org>
Thu, 18 Aug 2011 16:35:02 +0000 (12:35 -0400)
committerSimo Sorce <idra@samba.org>
Sun, 21 Aug 2011 13:05:07 +0000 (09:05 -0400)
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Simo Sorce <idra@samba.org>
source3/lib/server_prefork.c
source3/lib/server_prefork.h

index 016f65c5c374cc0ae79954c44d52789fdf86fe2f..a241e24798e6bb8beaab2e34684486781523f698 100644 (file)
@@ -83,6 +83,8 @@ bool prefork_create_pool(TALLOC_CTX *mem_ctx,
        }
        for (i = 0; i < listen_fd_size; i++) {
                pfp->listen_fds[i] = listen_fds[i];
+               /* force sockets in non-blocking mode */
+               set_blocking(listen_fds[i], false);
        }
        pfp->main_fn = main_fn;
        pfp->private_data = private_data;
index 1d203e6317e0a6d69470d74811a824996940e924..703080bcd799d9f70c17b978b1a20c8d2caeb458 100644 (file)
@@ -109,6 +109,9 @@ typedef void (prefork_sigchld_fn_t)(struct tevent_context *ev_ctx,
 * @param pf_pool       The allocated pool.
 *
 * @return True if it was successful, False otherwise.
+*
+* NOTE: each listen_fd is forced to non-blocking mode once handed over.
+* You should not toush listen_fds once you hand the to the prefork library.
 */
 bool prefork_create_pool(TALLOC_CTX *mem_ctx,
                         struct tevent_context *ev_ctx,