diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-01-27 23:12:35 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-01-27 23:12:35 +0000 |
commit | b97139a13b5b55da1858428c6dc802b5b50ffc9f (patch) | |
tree | b5d9860a98feb52db92b28c8623e633e5a28dce3 /src/log.c | |
parent | 51f874c0b35e9d14207663fb59b801c2495a9f21 (diff) | |
download | mpd-b97139a13b5b55da1858428c6dc802b5b50ffc9f.tar.gz mpd-b97139a13b5b55da1858428c6dc802b5b50ffc9f.tar.xz mpd-b97139a13b5b55da1858428c6dc802b5b50ffc9f.zip |
Redirect stdin *before* we establish a listen socket
This way we'll avoid listening on fd=0 and have a better
chance of having fd=0 as /dev/null
git-svn-id: https://svn.musicpd.org/mpd/branches/branch-0.13.0-fixes@7174 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/log.c')
-rw-r--r-- | src/log.c | 15 |
1 files changed, 0 insertions, 15 deletions
@@ -37,20 +37,6 @@ static int err_fd = -1; static const char *out_filename; static const char *err_filename; -/* redirect stdin to /dev/null to work around a libao bug */ -static void redirect_stdin(void) -{ - int fd, st; - struct stat ss; - - if ((st = fstat(STDIN_FILENO, &ss)) < 0 || ! isatty(STDIN_FILENO)) - return; - if ((fd = open("/dev/null", O_RDONLY)) < 0) - FATAL("failed to open /dev/null %s\n", strerror(errno)); - if (dup2(fd, STDIN_FILENO) < 0) - FATAL("dup2 stdin: %s\n", strerror(errno)); -} - static void redirect_logs(void) { assert(out_fd > 0); @@ -180,7 +166,6 @@ void setup_log_output(const int use_stdout) redirect_logs(); stdout_mode = 0; } - redirect_stdin(); } #define log_func(func,level,fp) \ |