summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie McClelland <jm@mayfirst.org>2010-12-21 23:29:15 -0500
committerJamie McClelland <jm@mayfirst.org>2010-12-21 23:29:15 -0500
commit98e5ebd65696db59063e45ee16da0f0923eda64a (patch)
tree4abff4e0b109fd1c55a7fcc587a9d66e913bd58b
parent368d659a675f2682ab8d1d2c9dad12928f49bfb4 (diff)
avoid problems with filenames containing regexp special characters.
-rwxr-xr-xexamples/monkeysphere-monitor-keys5
1 files changed, 1 insertions, 4 deletions
diff --git a/examples/monkeysphere-monitor-keys b/examples/monkeysphere-monitor-keys
index a5877d6..c5d0a0f 100755
--- a/examples/monkeysphere-monitor-keys
+++ b/examples/monkeysphere-monitor-keys
@@ -104,6 +104,7 @@ sub get_watcher {
push(@dirs,$dir);
my $file = basename($file);
if ( !grep $_ eq $file, @filters ) {
+ $file = quotemeta($file);
debug("Adding file filter: %s\n", $file);
push(@filters,$file);
}
@@ -111,10 +112,6 @@ sub get_watcher {
}
# create combined file filters to limit our monitor
-
- # FIXME: what if the elements of @filters have some regex characters
- # in them? this seems like it could match all kinds of crazy stuff
-
my $filter = '^(' . join("|",@filters) . ')$';
# return a watcher object