mirror of https://github.com/octoleo/lsyncd.git
code cleanups, improved delay debug logging
This commit is contained in:
parent
4c77666281
commit
40a46b6048
|
@ -112,13 +112,13 @@ rsyncssh.action = function( inlet )
|
||||||
-- uses ssh to delete files on remote host
|
-- uses ssh to delete files on remote host
|
||||||
-- instead of constructing rsync filters
|
-- instead of constructing rsync filters
|
||||||
|
|
||||||
if event.etype == 'Delete' then
|
if event.etype == 'Delete'
|
||||||
|
then
|
||||||
if
|
if config.delete ~= true
|
||||||
config.delete ~= true and
|
and config.delete ~= 'running'
|
||||||
config.delete ~= 'running'
|
|
||||||
then
|
then
|
||||||
inlet.discardEvent(event)
|
inlet.discardEvent( event )
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -133,7 +133,8 @@ rsyncssh.action = function( inlet )
|
||||||
-- returns the paths of the delete list
|
-- returns the paths of the delete list
|
||||||
local paths = elist.getPaths(
|
local paths = elist.getPaths(
|
||||||
function( etype, path1, path2 )
|
function( etype, path1, path2 )
|
||||||
if path2 then
|
if path2
|
||||||
|
then
|
||||||
return config.targetdir..path1, config.targetdir..path2
|
return config.targetdir..path1, config.targetdir..path2
|
||||||
else
|
else
|
||||||
return config.targetdir..path1
|
return config.targetdir..path1
|
||||||
|
@ -142,10 +143,13 @@ rsyncssh.action = function( inlet )
|
||||||
)
|
)
|
||||||
|
|
||||||
-- ensures none of the paths is '/'
|
-- ensures none of the paths is '/'
|
||||||
for _, v in pairs( paths ) do
|
for _, v in pairs( paths )
|
||||||
if string.match(v, '^%s*/+%s*$') then
|
do
|
||||||
log('Error', 'refusing to `rm -rf /` the target!')
|
if string.match( v, '^%s*/+%s*$' )
|
||||||
terminate(-1) -- ERRNO
|
then
|
||||||
|
log( 'Error', 'cowardly refusing to `rm -rf /` the target!' )
|
||||||
|
|
||||||
|
terminate( -1 ) -- ERRNO
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
545
lsyncd.lua
545
lsyncd.lua
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue