summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2017-10-19 15:14:16 +1300
committerAndrew Bartlett <abartlet@samba.org>2017-10-19 05:33:10 +0200
commit193afc55e6e467fa362ad93ea09ba0a92b6074a5 (patch)
tree9b721d916abc5b6e1c6e51fe6b59eac914f34e31 /source4/smbd
parent17d3a9d431c2babb730b7e35c076ee714ca6a9df (diff)
downloadsamba-193afc55e6e467fa362ad93ea09ba0a92b6074a5.tar.gz
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>
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/process_standard.c13
1 files changed, 5 insertions, 8 deletions
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) {