chiark / gitweb /
remove some pointless stderr redirection
authorRichard Kettlewell <rjk@greenend.org.uk>
Mon, 19 Nov 2007 21:05:16 +0000 (21:05 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Mon, 19 Nov 2007 21:05:16 +0000 (21:05 +0000)
server/play.c
server/trackdb.c

index 01d80a6f49181bf76e41e41b8776e6ae0f69d4f6..bd27474ce40a17ebd3ca23e4a672b4a25cbdfb21 100644 (file)
@@ -127,16 +127,12 @@ static int speaker_readable(ev_source *ev, int fd,
 }
 
 void speaker_setup(ev_source *ev) {
 }
 
 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");
   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);
   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]);
     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,
     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));
          }
            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);
          execlp("disorder-normalize", "disorder-normalize",
                 log_default == &log_syslog ? "--syslog" : "--no-syslog",
                 (char *)0);
index b0eb38333f8d3460ba8e5f605ba492231de218f9..8cfd71f76f7b4b72d5c594eeae4937d6f251fee9 100644 (file)
@@ -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;
 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 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(!(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);
     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);
   }
            (char *)0);
     fatal(errno, "error invoking %s", prog);
   }
-  if(lfd != -1) xclose(lfd);
   return pid;
 }
 
   return pid;
 }