mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-23 07:08:33 +00:00
fixing masterloop
This commit is contained in:
parent
58b4f21d56
commit
306d117959
11
lsyncd.c
11
lsyncd.c
@ -905,7 +905,7 @@ l_stackdump(lua_State* L)
|
||||
|
||||
/**
|
||||
* Reads the directories entries.
|
||||
* XXX
|
||||
*
|
||||
* @param (Lua stack) absolute path to directory.
|
||||
* @return (Lua stack) a table of directory names.
|
||||
* names are keys, values are boolean
|
||||
@ -1332,6 +1332,15 @@ masterloop(lua_State *L)
|
||||
/* nothing more inotify */
|
||||
break;
|
||||
}
|
||||
if (len < 0) {
|
||||
if (errno == EAGAIN) {
|
||||
/* nothing more inotify */
|
||||
break;
|
||||
} else {
|
||||
printlogf(L, "Error", "Read fail on inotify");
|
||||
exit(-1); // ERRNO
|
||||
}
|
||||
}
|
||||
while (i < len && !hup && !term) {
|
||||
struct inotify_event *event =
|
||||
(struct inotify_event *) &readbuf[i];
|
||||
|
11
lsyncd.lua
11
lsyncd.lua
@ -1475,8 +1475,14 @@ local Inotifies = (function()
|
||||
|
||||
-- registers and adds watches for all subdirectories
|
||||
-- and/or raises create events for all entries
|
||||
if recurse or raise then
|
||||
if not recurse and not raise then
|
||||
return
|
||||
end
|
||||
|
||||
local entries = lsyncd.readdir(path)
|
||||
if not entries then
|
||||
return
|
||||
end
|
||||
for dirname, isdir in pairs(entries) do
|
||||
local pd = path .. dirname
|
||||
if isdir then
|
||||
@ -1493,7 +1499,6 @@ local Inotifies = (function()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-----
|
||||
-- Stops watching a directory
|
||||
@ -1505,7 +1510,7 @@ local Inotifies = (function()
|
||||
end
|
||||
lsyncd.inotifyrm(wd)
|
||||
wdpaths[wd] = nil
|
||||
pathwids[path] = nil
|
||||
pathwds[path] = nil
|
||||
end
|
||||
|
||||
-----
|
||||
|
@ -16,7 +16,8 @@ local trgdir = tdir.."trg/"
|
||||
|
||||
posix.mkdir(srcdir)
|
||||
posix.mkdir(trgdir)
|
||||
local pid = spawn("./lsyncd","-nodaemon","-rsync",srcdir,trgdir)
|
||||
--local pid = spawn("./lsyncd","-nodaemon","-rsync",srcdir,trgdir,"-log", "all")
|
||||
local pid = spawn("./lsyncd","-nodaemon","-rsync",srcdir,trgdir,"-log","all")
|
||||
|
||||
cwriteln("waiting for Lsyncd to startup")
|
||||
posix.sleep(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user