1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

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 <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Gary Lockyer 2017-10-19 15:14:16 +13:00 committed by Andrew Bartlett
parent 17d3a9d431
commit 193afc55e6

View File

@ -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) {