Finally fixed mysterious error 13. rsync fails 'cause Lsyncd reopened stderr in read mode

This commit is contained in:
Axel Kittenberger 2012-02-15 15:16:00 +01:00
parent d667b90864
commit 5ce47d47a3
2 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,8 @@
fix: no longer stops syslogging on HUP signals
fix: OSX event watcher no longer misses moves into and out of the watch tree
fix: not refinding a relative path to the config file in case of HUP.
fix: rsync doing error 13 and killing Lsyncd.
see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=659941
change: Lsyncd now remembers the absolute path of its config file during HUPs
25-08-2011: 2.0.5

View File

@ -479,6 +479,7 @@ close_exec_fd(int fd)
logstring("Error", "cannot get descriptor flags!");
exit(-1); // ERRNO
}
flags |= FD_CLOEXEC;
if (fcntl(fd, F_SETFD, flags) == -1) {
logstring("Error", "cannot set descripptor flags!");
@ -904,6 +905,7 @@ l_exec(lua_State *L)
if (!freopen(settings.log_file, "a", stdout)) {
printlogf(L, "Error", "cannot redirect stdout to '%s'.", settings.log_file);
}
if (!freopen(settings.log_file, "a", stderr)) {
printlogf(L, "Error", "cannot redirect stderr to '%s'.", settings.log_file);
}
@ -1466,8 +1468,8 @@ daemonize(lua_State *L)
// disconnects stdstreams
if (!freopen("/dev/null", "r", stdin) ||
!freopen("/dev/null", "r", stdout) ||
!freopen("/dev/null", "r", stderr)
!freopen("/dev/null", "w", stdout) ||
!freopen("/dev/null", "w", stderr)
) {
printlogf(L, "Error", "Failure in daemonize at freopen(/dev/null, std[in|out|err])");
}