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>
This commit is contained in:
Lucas Werkmeister 2018-04-04 00:13:07 +02:00 коммит произвёл Junio C Hamano
Родитель 0c591cacba
Коммит e67d906d73
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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");
}