]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Allow to start server and audiod as daemon with no logfile.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 7 Oct 2014 14:02:07 +0000 (14:02 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 30 Apr 2015 15:54:51 +0000 (17:54 +0200)
Currently para_audiod and para_server won't start in the background
if no logfile is specified, so "-dL /dev/null" must be given to force
this. This is a bit tedious to type, so this commit makes "/dev/null"
the default.

To achive this, we can simply remove the gengetopt "dependon" statement
from daemon.m4. This works because if no logfile was given, log output
is written to stderr, which is redirected to /dev/null in case -d
was also given. We need to open /dev/null in read-write mode though,
but no other changes are required.

NEWS
daemon.c
m4/gengetopt/daemon.m4

diff --git a/NEWS b/NEWS
index 22e16ebe869dfc976f0cc0e6117036153c77e46d..2eaad812d3b617cd1fb048c129139e354a4d59e5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ current master branch "magnetic momentum"
        - New autoconf macros to avoid duplication in configure.ac.
        - Status items (as shown by para_gui) are updated correctly
          when the meta information of the current audio changes.
        - New autoconf macros to avoid duplication in configure.ac.
        - Status items (as shown by para_gui) are updated correctly
          when the meta information of the current audio changes.
+       - para_server and para_audiod no longer refuse to start in
+         the background if no log file is given. Instead, all log
+         messages go to /dev/null in this case.
 
 Download: ./releases/paraslash-git.tar.bz2 (tarball)
 
 
 Download: ./releases/paraslash-git.tar.bz2 (tarball)
 
index 316432e68a5f116c9f2035d9bfb661b99b7061a1..ca74595695985ad866c6ad849cbc343e2801850a 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -199,7 +199,7 @@ void daemonize(bool parent_waits)
                goto err;
        if (chdir("/") < 0)
                goto err;
                goto err;
        if (chdir("/") < 0)
                goto err;
-       null = open("/dev/null", O_RDONLY);
+       null = open("/dev/null", O_RDWR);
        if (null < 0)
                goto err;
        if (dup2(null, STDIN_FILENO) < 0)
        if (null < 0)
                goto err;
        if (dup2(null, STDIN_FILENO) < 0)
index b4e842ac049f4832e21e96a24658fab162f22a83..ebead6a806f372d63e0e5aaf2f4b4a1aba00f479 100644 (file)
@@ -3,9 +3,8 @@ option "daemon" d
 #~~~~~~~~~~~~~~~~
 "run as background daemon"
 flag off
 #~~~~~~~~~~~~~~~~
 "run as background daemon"
 flag off
-dependon="logfile"
-details="
-       Note that </qu>CURRENT_PROGRAM<qu> refuses to start in daemon mode if no
-       logfile was specified.
+details = "
+       If this option is given and no logfile was specified, all
+       messages go to /dev/null.
 "
 </qu>
 "
 </qu>