diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-03-02 19:32:56 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-03-04 10:14:34 +0100 |
commit | b07d504ca4e476d492beb5552344070e4f96464a (patch) | |
tree | ef1bebdd28e09a6ac8acc88a3abf8d518d23161c /lib/util/debug.c | |
parent | 679bbd014e03f60cddbcabfe0c6b5b8bae9fea4c (diff) | |
download | samba-b07d504ca4e476d492beb5552344070e4f96464a.tar.gz samba-b07d504ca4e476d492beb5552344070e4f96464a.tar.bz2 samba-b07d504ca4e476d492beb5552344070e4f96464a.zip |
change low FDs are handled in Samba
We now only close fds 0, 1, 2 when we are a forked daemon, and take
care not to close a file descriptor that we might need for foreground
stdin monitoring.
This should fix stdout logging in the lsa and epmapper deamons (ie in
make test).
Andrew Bartlett
Diffstat (limited to 'lib/util/debug.c')
-rw-r--r-- | lib/util/debug.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c index a6388513c7..a7e2a0f78e 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -592,9 +592,14 @@ bool reopen_logs_internal(void) (void)umask(oldumask); /* Take over stderr to catch output into logs */ - if (state.fd > 0 && dup2(state.fd, 2) == -1) { - close_low_fds(true); /* Close stderr too, if dup2 can't point it - at the logfile */ + if (state.fd > 0) { + if (dup2(state.fd, 2) == -1) { + /* Close stderr too, if dup2 can't point it - + at the logfile. There really isn't much + that can be done on such a fundemental + failure... */ + close_low_fds(false, false, true); + } } state.reopening_logs = false; |