mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-04 19:03:17 +00:00
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
|
||||
-- instead of constructing rsync filters
|
||||
|
||||
if event.etype == 'Delete' then
|
||||
|
||||
if
|
||||
config.delete ~= true and
|
||||
config.delete ~= 'running'
|
||||
if event.etype == 'Delete'
|
||||
then
|
||||
if config.delete ~= true
|
||||
and config.delete ~= 'running'
|
||||
then
|
||||
inlet.discardEvent(event)
|
||||
inlet.discardEvent( event )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
@ -133,7 +133,8 @@ rsyncssh.action = function( inlet )
|
||||
-- returns the paths of the delete list
|
||||
local paths = elist.getPaths(
|
||||
function( etype, path1, path2 )
|
||||
if path2 then
|
||||
if path2
|
||||
then
|
||||
return config.targetdir..path1, config.targetdir..path2
|
||||
else
|
||||
return config.targetdir..path1
|
||||
@ -142,10 +143,13 @@ rsyncssh.action = function( inlet )
|
||||
)
|
||||
|
||||
-- ensures none of the paths is '/'
|
||||
for _, v in pairs( paths ) do
|
||||
if string.match(v, '^%s*/+%s*$') then
|
||||
log('Error', 'refusing to `rm -rf /` the target!')
|
||||
terminate(-1) -- ERRNO
|
||||
for _, v in pairs( paths )
|
||||
do
|
||||
if string.match( v, '^%s*/+%s*$' )
|
||||
then
|
||||
log( 'Error', 'cowardly refusing to `rm -rf /` the target!' )
|
||||
|
||||
terminate( -1 ) -- ERRNO
|
||||
end
|
||||
end
|
||||
|
||||
|
545
lsyncd.lua
545
lsyncd.lua
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user