From: Andre Noll Date: Mon, 30 Mar 2015 16:20:16 +0000 (+0000) Subject: daemon.c: Open /dev/null read-write. X-Git-Tag: v0.1.6~2^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=commitdiff_plain;h=5b5d7b59a34579ba86ce620ee527ffad087c9b60;hp=34cec69f582576b8845b5bb6b544afc321f46d29 daemon.c: Open /dev/null read-write. While daemonizing we redirect stdin, stdout and stderr to /dev/null, which is considered good practice. We should, however, open these two devices in read-write mode rather than read-only, since not being able to write to stdout/stderr might confuse rsync and the hooks. --- diff --git a/daemon.c b/daemon.c index b63e5ff..24bbfe5 100644 --- a/daemon.c +++ b/daemon.c @@ -48,7 +48,7 @@ void daemon_init(void) if (chdir("/") < 0) goto err; umask(0); - null = open("/dev/null", O_RDONLY); + null = open("/dev/null", O_RDWR); if (null < 0) goto err; if (dup2(null, STDIN_FILENO) < 0)