From: Andre Noll Date: Tue, 7 Oct 2014 14:02:07 +0000 (+0000) Subject: Allow to start server and audiod as daemon with no logfile. X-Git-Tag: v0.5.5~38 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=db212616a42fb6d33385f79cfc9b8cca9721a8b9;p=paraslash.git Allow to start server and audiod as daemon with no logfile. 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. --- diff --git a/NEWS b/NEWS index 22e16ebe..2eaad812 100644 --- 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. + - 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) diff --git a/daemon.c b/daemon.c index 316432e6..ca745956 100644 --- a/daemon.c +++ b/daemon.c @@ -199,7 +199,7 @@ void daemonize(bool parent_waits) 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) diff --git a/m4/gengetopt/daemon.m4 b/m4/gengetopt/daemon.m4 index b4e842ac..ebead6a8 100644 --- a/m4/gengetopt/daemon.m4 +++ b/m4/gengetopt/daemon.m4 @@ -3,9 +3,8 @@ option "daemon" d #~~~~~~~~~~~~~~~~ "run as background daemon" flag off -dependon="logfile" -details=" - Note that CURRENT_PROGRAM 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. "