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.
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)