From b955a1c1b6d466977d971c029a9305bee492f73c Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 20 Aug 2010 20:12:51 +0100 Subject: [PATCH] master: Fixed log_path=/dev/stderr --- src/master/service-process.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/master/service-process.c b/src/master/service-process.c index 3575081588..fc589a8d94 100644 --- a/src/master/service-process.c +++ b/src/master/service-process.c @@ -117,7 +117,11 @@ service_dup_fds(struct service *service) } dup2_append(&dups, service->status_fd[1], MASTER_STATUS_FD); - if (service->type != SERVICE_TYPE_LOG) { + if (service->type == SERVICE_TYPE_LOG) { + /* keep stderr as-is. this is especially important when + log_path=/dev/stderr, but might be helpful even in other + situations for logging startup errors */ + } else { /* set log file to stderr. dup2() here immediately so that we can set up logging to it without causing any log messages to be lost. */ @@ -127,8 +131,6 @@ service_dup_fds(struct service *service) if (dup2(service->log_fd[1], STDERR_FILENO) < 0) i_fatal("dup2(log fd) failed: %m"); i_set_failure_internal(); - } else { - dup2_append(&dups, null_fd, STDERR_FILENO); } /* make sure we don't leak syslog fd. try to do it as late as possible, -- 2.47.3