Skip to content

Commit

Permalink
Do not follow into symlinked directories when traversing directories (#…
Browse files Browse the repository at this point in the history
…60)

and :dont_follow and :recursive are in effect.
  • Loading branch information
juhaerk authored and nex3 committed Jan 26, 2017
1 parent 5aa4bdb commit ecb2cc7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rb-inotify/notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ def watch(path, *flags, &callback)
d = File.join(path, base)
binary_d = d.respond_to?(:force_encoding) ? d.dup.force_encoding('BINARY') : d
next if binary_d =~ /\/\.\.?$/ # Current or parent directory
watch(d, *flags, &callback) if !RECURSIVE_BLACKLIST.include?(d) && File.directory?(d)
next if RECURSIVE_BLACKLIST.include?(d)
next if flags.include?(:dont_follow) && File.symlink?(d)
next if !File.directory?(d)

watch(d, *flags, &callback)
end

dir.close
Expand Down

0 comments on commit ecb2cc7

Please sign in to comment.