From: Gary Lockyer Date: Thu, 19 Oct 2017 02:14:16 +0000 (+1300) Subject: process_standard: Move child pipe setup further down standard_accept_connection() X-Git-Tag: tevent-0.9.34~177 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=193afc55e6e467fa362ad93ea09ba0a92b6074a5;p=thirdparty%2Fsamba.git process_standard: Move child pipe setup further down standard_accept_connection() This avoids cleaning up on error from accept() but more importantly allows a future mode that acts like process_single and so has no child. Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c index 4d2aa95104f..f5922c8d91c 100644 --- a/source4/smbd/process_standard.c +++ b/source4/smbd/process_standard.c @@ -248,28 +248,25 @@ static void standard_accept_connection( struct tevent_signal *se = NULL; struct process_context *proc_ctx = NULL; - state = setup_standard_child_pipe(ev, NULL); - if (state == NULL) { - return; - } /* accept an incoming connection. */ status = socket_accept(sock, &sock2); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("standard_accept_connection: accept: %s\n", - nt_errstr(status))); + nt_errstr(status))); /* this looks strange, but is correct. We need to throttle things until the system clears enough resources to handle this new socket */ sleep(1); - close(state->to_parent_fd); - state->to_parent_fd = -1; - TALLOC_FREE(state); return; } proc_ctx = talloc_get_type_abort(process_context, struct process_context); + state = setup_standard_child_pipe(ev, NULL); + if (state == NULL) { + return; + } pid = fork(); if (pid != 0) {