s3-smbd: Don't close stdout if we want to log to stdout.
Andrew Bartlett
abartlet at samba.org
Fri Mar 26 16:21:42 MDT 2010
On Fri, 2010-03-26 at 08:49 -0500, Andreas Schneider wrote:
> The branch, master has been updated
> via a6f25fc... s3-smbd: Don't close stdout if we want to log to stdout.
> from f70e1b4... s4-smbtorture: fail spoolss test on SetJob failure.
>
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
>
>
> - Log -----------------------------------------------------------------
> commit a6f25fc635dce0b67422b271e09467e9ea854489
> Author: Andreas Schneider <asn at redhat.com>
> Date: Fri Mar 26 11:17:37 2010 +0100
>
> s3-smbd: Don't close stdout if we want to log to stdout.
>
> -----------------------------------------------------------------------
>
> Summary of changes:
> lib/util/become_daemon.c | 10 ++++++----
> lib/util/util.h | 2 +-
> source3/nmbd/nmbd.c | 2 +-
> source3/smbd/server.c | 2 +-
> source3/web/startstop.c | 6 +++---
> source3/winbindd/winbindd.c | 2 +-
> source4/smbd/server.c | 2 +-
> 7 files changed, 14 insertions(+), 12 deletions(-)
>
>
> Changeset truncated at 500 lines:
>
> diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
> index 3d06a43..2af1631 100644
> --- a/lib/util/become_daemon.c
> +++ b/lib/util/become_daemon.c
> @@ -66,7 +66,7 @@ _PUBLIC_ void close_low_fds(bool stderr_too)
> Become a daemon, discarding the controlling terminal.
> ****************************************************************************/
>
> -_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group)
> +_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout)
> {
> if (do_fork) {
> if (sys_fork()) {
> @@ -87,7 +87,9 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group)
> }
> #endif /* HAVE_SETSID */
>
> - /* Close fd's 0,1,2. Needed if started by rsh */
> - close_low_fds(false); /* Don't close stderr, let the debug system
> - attach it to the logfile */
> + if (!log_stdout) {
> + /* Close fd's 0,1,2. Needed if started by rsh */
> + close_low_fds(false); /* Don't close stderr, let the debug system
> + attach it to the logfile */
> + }
> }
Didn't we just have a discussion on the list about never closing them at
all? Or was that similar but somehow unrelated to this particular bit
of code?
Andrew Bartlett
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Cisco Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100327/2b7a940a/attachment.pgp>
More information about the samba-technical
mailing list