diff --git a/lsyncd.c b/lsyncd.c index 2db9119..44fcb60 100644 --- a/lsyncd.c +++ b/lsyncd.c @@ -600,6 +600,10 @@ l_log(lua_State *L) } lua_replace(L, i); break; + case LUA_TNIL: + lua_pushstring(L, "(nil)"); + lua_replace(L, i); + break; } } } @@ -993,6 +997,7 @@ l_configure(lua_State *L) if (!settings.log_file) { settings.log_syslog = true; } + logstring("Debug", "daemonizing now."); if (daemon(0, 0)) { logstring("Error", "Failed to daemonize"); exit(-1); //ERRNO @@ -1213,7 +1218,7 @@ handle_event(lua_State *L, lua_pushnil(L); lua_pushnil(L); } - if (lua_pcall(L, 7, 0, -8)) { + if (lua_pcall(L, 7, 0, -9)) { exit(-1); // ERRNO } lua_pop(L, 1); @@ -1499,7 +1504,7 @@ main1(int argc, char *argv[]) logstring("Error", "Using a staticly included runner as default."); #endif - return -1; //ERRNO + exit(-1); //ERRNO } lsyncd_runner_file = argv[argp + 1]; argp += 2; diff --git a/lsyncd.lua b/lsyncd.lua index 3deb7f7..40ce861 100644 --- a/lsyncd.lua +++ b/lsyncd.lua @@ -1442,7 +1442,7 @@ local Inotifies = (function() -- The same vice versa, all watch descriptors by its -- absolute path. -- - local pathwds = CountArray.new() + local pathwds = {} ----- -- A list indexed by sync's containing the root path this @@ -1461,7 +1461,8 @@ local Inotifies = (function() -- local function addWatch(path, recurse, raiseSync, raiseTime) log("Function", - "Inotifies.addWatch(",path,", ",recurse,", ",sync,", ",raise")") + "Inotifies.addWatch(",path,", ",recurse,", ", + raiseSync,", ",raiseTime,")") local wd = pathwds[path] if not wd then @@ -1553,7 +1554,7 @@ local Inotifies = (function() end -- looks up the watch descriptor id - local path = wdlist[wd] + local path = wdpaths[wd] if not path then -- this is normal in case of deleted subdirs log("Inotify", "event belongs to unknown watch descriptor.")