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 <mail@lucaswerkmeister.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Lucas Werkmeister committed Apr 4, 2018 at 00:13 UTC e67d906d735166f2068f1e4cc393220483a97f30
1 file changed +1 -1
daemon.c
+1 -1
@@ -1462,7 +1462,7 @@ int cmd_main(int argc, const char **argv)
1462 die("base-path '%s' does not exist or is not a directory",
1463 base_path);
1464
1465 - if (inetd_mode) {
1465 + if (log_destination != LOG_DESTINATION_STDERR) {
1466 if (!freopen("/dev/null", "w", stderr))
1467 die_errno("failed to redirect stderr to /dev/null");
1468 }