Skip to content

Commit

Permalink
Update notify.c for issue #254 (#257)
Browse files Browse the repository at this point in the history
Move the block of code that initializes mark_flag out of the loop so that it's always initialized, even if no watched mount points are initially present.
  • Loading branch information
wjhunter3 authored Aug 1, 2023
1 parent 6e9a715 commit 00601b9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/daemon/notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,20 @@ int init_fanotify(const conf_t *conf, mlist *m)

mask = FAN_OPEN_PERM | FAN_OPEN_EXEC_PERM;

// Iterate through the mount points and add a mark
path = mlist_first(m);
while (path) {
#if defined HAVE_DECL_FAN_MARK_FILESYSTEM && HAVE_DECL_FAN_MARK_FILESYSTEM != 0
if (conf->allow_filesystem_mark)
mark_flag = FAN_MARK_FILESYSTEM;
else
mark_flag = FAN_MARK_MOUNT;
if (conf->allow_filesystem_mark)
mark_flag = FAN_MARK_FILESYSTEM;
else
mark_flag = FAN_MARK_MOUNT;
#else
if (conf->allow_filesystem_mark)
msg(LOG_ERR,
if (conf->allow_filesystem_mark)
msg(LOG_ERR,
"allow_filesystem_mark is unsupported for this kernel - ignoring");
mark_flag = FAN_MARK_MOUNT;
mark_flag = FAN_MARK_MOUNT;
#endif
// Iterate through the mount points and add a mark
path = mlist_first(m);
while (path) {
retry_mark:
if (fanotify_mark(fd, FAN_MARK_ADD | mark_flag,
mask, -1, path) == -1) {
Expand Down

0 comments on commit 00601b9

Please sign in to comment.