diff options
author | Max Kellermann <max@duempel.org> | 2009-11-07 17:48:57 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-07 17:48:57 +0100 |
commit | c440faa94dad1a9d7cae4947351a2704a9975cd9 (patch) | |
tree | 553fb4f15e6882a0879d654a65ee2dd49dec4c32 /src | |
parent | 375fd5ed4c33343a82f9e7b728c720e396431e5d (diff) | |
download | mpd-c440faa94dad1a9d7cae4947351a2704a9975cd9.tar.gz mpd-c440faa94dad1a9d7cae4947351a2704a9975cd9.tar.xz mpd-c440faa94dad1a9d7cae4947351a2704a9975cd9.zip |
log: redirect stdout/stderr to /dev/null if syslog is used
Don't hold a file descriptor on root's tty when syslog is used for
logging.
Diffstat (limited to '')
-rw-r--r-- | src/log.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -271,7 +271,10 @@ void setup_log_output(bool use_stdout) { fflush(NULL); if (!use_stdout) { - if (out_filename != NULL) { + if (out_filename == NULL) + out_fd = open("/dev/null", O_WRONLY); + + if (out_fd >= 0) { redirect_logs(out_fd); close(out_fd); } |