From c440faa94dad1a9d7cae4947351a2704a9975cd9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 7 Nov 2009 17:48:57 +0100 Subject: 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. --- src/log.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/log.c b/src/log.c index 94691ab64..3a9795d7d 100644 --- a/src/log.c +++ b/src/log.c @@ -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); } -- cgit v1.2.3