From: Aki Tuomi Date: Mon, 18 Jan 2016 13:50:23 +0000 (+0200) Subject: master: Do not close stdout if going foreground X-Git-Tag: 2.2.22.rc1~316 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5b63d2b3b091ca30af859c521644fe7156f65f4b;p=thirdparty%2Fdovecot%2Fcore.git master: Do not close stdout if going foreground This lets one to use /dev/stdout for logging. Mainly useful for testing purposes where we can generate log output to stdout and use tee to write it to a file for later examination. --- diff --git a/src/master/main.c b/src/master/main.c index b26279c8ef..a98a0b4c56 100644 --- a/src/master/main.c +++ b/src/master/main.c @@ -838,8 +838,9 @@ int main(int argc, char *argv[]) t_askpass("Give the password for SSL keys: "); } - if (dup2(null_fd, STDIN_FILENO) < 0 || - dup2(null_fd, STDOUT_FILENO) < 0) + if (dup2(null_fd, STDIN_FILENO) < 0) + i_fatal("dup2(null_fd) failed: %m"); + if (!foreground && dup2(null_fd, STDOUT_FILENO) < 0) i_fatal("dup2(null_fd) failed: %m"); pidfile_path =