From: Lucas Werkmeister Date: Tue, 3 Apr 2018 22:13:07 +0000 (+0200) Subject: daemon.c: fix condition for redirecting stderr X-Git-Tag: v2.18.0-rc0~120^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/e67d906d735166f2068f1e4cc393220483a97f30 daemon.c: fix condition for redirecting stderr Since the --log-destination option was added in 0c591cacb ("daemon: add --log-destination=(stderr|syslog|none)", 2018-02-04) with the explicit goal of allowing logging to stderr when running in inetd mode, we should not always redirect stderr to /dev/null in inetd mode, but rather only when stderr is not being used for logging. Signed-off-by: Lucas Werkmeister Signed-off-by: Junio C Hamano --- diff --git a/daemon.c b/daemon.c index fb538e3678..7857169055 100644 --- a/daemon.c +++ b/daemon.c @@ -1462,7 +1462,7 @@ int cmd_main(int argc, const char **argv) die("base-path '%s' does not exist or is not a directory", base_path); - if (inetd_mode) { + if (log_destination != LOG_DESTINATION_STDERR) { if (!freopen("/dev/null", "w", stderr)) die_errno("failed to redirect stderr to /dev/null"); }