]> git.tuebingen.mpg.de Git - dss.git/commitdiff
daemon.c: Open /dev/null read-write.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 Mar 2015 16:20:16 +0000 (16:20 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 14 Apr 2015 09:11:22 +0000 (11:11 +0200)
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.

daemon.c

index b63e5ff57b408a79e62d44349cb9fd9d342b956e..24bbfe5cdaaa22b03924fd4aba0cf379a1de22e1 100644 (file)
--- 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)