aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-04 00:31:23 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-04 00:31:23 +1200
commit0e1d63174dcfe60ea5c3e16aee5b4c49368fcd15 (patch)
treea5d1eb3098993bdb943ea91db6f4e567b3663522
parentMerge branch 'hotfix/v0.05' into develop (diff)
parentBump VERSION (diff)
downloadinotifymask-0e1d63174dcfe60ea5c3e16aee5b4c49368fcd15.tar.gz
inotifymask-0e1d63174dcfe60ea5c3e16aee5b4c49368fcd15.zip
Merge branch 'hotfix/v0.06' into develop
* hotfix/v0.06: Monitor attribute changes too
-rw-r--r--bin/inotifymask10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/inotifymask b/bin/inotifymask
index d5bfcb0..8c8ad98 100644
--- a/bin/inotifymask
+++ b/bin/inotifymask
@@ -9,7 +9,7 @@ use Const::Fast;
use File::stat;
use Linux::Inotify2;
-our $VERSION = '0.05';
+our $VERSION = '0.06';
const our $SELF => 'inotifymask';
@@ -46,8 +46,12 @@ my $cb = sub {
# Get the mode we want for the file, masking off irrelevant file type bits
my $mode = $stat->mode & $STAT_MASK;
+ #
# Check that at least one bit of the mask coincides with one bit of the
- # present mode, i.e. that we'll be changing anything
+ # present mode, i.e. that we'll be changing anything; this is important
+ # because we might otherwise get misleading log entries, and maybe even an
+ # infinite loop...!
+ #
$mode & $mask
or return;
@@ -62,7 +66,7 @@ my $cb = sub {
# Create object and set up watches with callback, start polling
my $in = Linux::Inotify2->new;
for (@files) {
- $in->watch( $_, IN_CREATE | IN_MOVED_TO, $cb );
+ $in->watch( $_, IN_ATTRIB | IN_CREATE | IN_MOVED_TO, $cb );
}
while (1) {
$in->poll;