diff options
author | Marc VanHeyningen <marc.vanheyningen@isilon.com> | 2009-05-05 21:18:50 +0000 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2009-05-27 13:16:17 -0700 |
commit | a4887e250b84c321c75d54b9d3adf6fcf7c27fed (patch) | |
tree | 318c1079a6199d283bed94ee3733c9e32855922c /source3/lib | |
parent | 75de7c0e87cc5ecea1a7d7e9b0103a8cc2827895 (diff) | |
download | samba-a4887e250b84c321c75d54b9d3adf6fcf7c27fed.tar.gz samba-a4887e250b84c321c75d54b9d3adf6fcf7c27fed.tar.bz2 samba-a4887e250b84c321c75d54b9d3adf6fcf7c27fed.zip |
s3: Allow child processes to exit gracefully if we are out of fds
When we run out of file descriptors for some reason, every new
connection forks a child that immediately panics causing smbd to
coredump. This seems unnecessarily harsh; with this code change we
now catch that error and merely log a message about it and exit
without the core dump.
Signed-off-by: Tim Prouty <tprouty@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 13f7e3c9ee..8e67edeae6 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -927,11 +927,11 @@ void smb_msleep(unsigned int t) #endif } -bool reinit_after_fork(struct messaging_context *msg_ctx, +NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx, struct event_context *ev_ctx, bool parent_longlived) { - NTSTATUS status; + NTSTATUS status = NT_STATUS_OK; /* Reset the state of the random * number generation system, so @@ -942,7 +942,8 @@ bool reinit_after_fork(struct messaging_context *msg_ctx, /* tdb needs special fork handling */ if (tdb_reopen_all(parent_longlived ? 1 : 0) == -1) { DEBUG(0,("tdb_reopen_all failed.\n")); - return false; + status = NT_STATUS_OPEN_FAILED; + goto done; } if (ev_ctx) { @@ -958,11 +959,10 @@ bool reinit_after_fork(struct messaging_context *msg_ctx, if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("messaging_reinit() failed: %s\n", nt_errstr(status))); - return false; } } - - return true; + done: + return status; } /**************************************************************************** |