From 4387f694f74e3a797209032ea43fb355c89487a3 Mon Sep 17 00:00:00 2001 Message-Id: <4387f694f74e3a797209032ea43fb355c89487a3.1715608337.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 19 Nov 2007 21:05:16 +0000 Subject: [PATCH] remove some pointless stderr redirection Organization: Straylight/Edgeware From: Richard Kettlewell --- server/play.c | 12 +++--------- server/trackdb.c | 11 ----------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/server/play.c b/server/play.c index 01d80a6..bd27474 100644 --- a/server/play.c +++ b/server/play.c @@ -127,16 +127,12 @@ static int speaker_readable(ev_source *ev, int fd, } void speaker_setup(ev_source *ev) { - int sp[2], lfd; + int sp[2]; pid_t pid; struct speaker_message sm; if(socketpair(PF_UNIX, SOCK_DGRAM, 0, sp) < 0) fatal(errno, "error calling socketpair"); - if(!isatty(2)) - lfd = logfd(ev, SPEAKER); - else - lfd = -1; if(!(pid = xfork())) { exitfn = _exit; ev_signal_atfork(ev); @@ -144,10 +140,6 @@ void speaker_setup(ev_source *ev) { xdup2(sp[0], 1); xclose(sp[0]); xclose(sp[1]); - if(lfd != -1) { - xdup2(lfd, 2); - xclose(lfd); - } signal(SIGPIPE, SIG_DFL); #if 0 execlp("valgrind", "valgrind", SPEAKER, "--config", configfile, @@ -428,6 +420,8 @@ static int start(ev_source *ev, speaker_send(speaker_fd, &sm); D(("sent SM_PLAY for %s", sm.id)); } + /* TODO stderr shouldn't be redirected for disorder-normalize + * (but it should be for play_track() */ execlp("disorder-normalize", "disorder-normalize", log_default == &log_syslog ? "--syslog" : "--no-syslog", (char *)0); diff --git a/server/trackdb.c b/server/trackdb.c index b0eb383..8cfd71f 100644 --- a/server/trackdb.c +++ b/server/trackdb.c @@ -157,22 +157,12 @@ static int reap_db_deadlock(ev_source attribute((unused)) *ev, static pid_t subprogram(ev_source *ev, const char *prog, int outputfd) { pid_t pid; - int lfd; /* If we're in the background then trap subprocess stdout/stderr */ - if(!isatty(2)) - lfd = logfd(ev, prog); - else - lfd = -1; if(!(pid = xfork())) { exitfn = _exit; ev_signal_atfork(ev); signal(SIGPIPE, SIG_DFL); - if(lfd != -1) { - xdup2(lfd, 1); - xdup2(lfd, 2); - xclose(lfd); - } if(outputfd != -1) { xdup2(outputfd, 1); xclose(outputfd); @@ -186,7 +176,6 @@ static pid_t subprogram(ev_source *ev, const char *prog, (char *)0); fatal(errno, "error invoking %s", prog); } - if(lfd != -1) xclose(lfd); return pid; } -- [mdw]