Skip to content

Commit 946114f

Browse files
committed
bugfix
1 parent 1dc8338 commit 946114f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/ext.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ handle_events(int fd, struct c_rule **rules, int sk_fd, int log_fd)
514514
exe.buf[0] = cwd.buf[0] = path.buf[0] = evt.buf[0] = '\0';
515515
exe.len = cwd.len = path.len = evt.len = 0;
516516

517+
#ifdef FAN_REPORT_FID
517518
if (ev->event_len != FAN_EVENT_METADATA_LEN) {
518519
info_len = ev->event_len - ev->metadata_len;
519520
ssize_t rest = info_len;
@@ -525,15 +526,17 @@ handle_events(int fd, struct c_rule **rules, int sk_fd, int log_fd)
525526
while (rest) {
526527
switch (finfo->info_type) {
527528
case FAN_EVENT_INFO_TYPE_FID:
529+
# ifdef FAN_REPORT_DIR_FID
528530
case FAN_EVENT_INFO_TYPE_DFID:
529531
case FAN_EVENT_INFO_TYPE_DFID_NAME:
532+
# endif // FAN_REPORT_DIR_FID
530533
fid = (struct fanotify_event_info_fid *)finfo;
531534
file_handle = (struct file_handle *)fid->handle;
532535
break;
533-
case FAN_EVENT_INFO_TYPE_PIDFD:
536+
// case FAN_EVENT_INFO_TYPE_PIDFD:
534537
// pidfd = (struct fanotify_event_info_pidfd *)finfo;
535538
// break;
536-
case FAN_EVENT_INFO_TYPE_ERROR:
539+
// case FAN_EVENT_INFO_TYPE_ERROR:
537540
// ierror = (struct fanotify_event_info_error *)finfo;
538541
// break;
539542
default:
@@ -542,8 +545,10 @@ handle_events(int fd, struct c_rule **rules, int sk_fd, int log_fd)
542545
close(dfd);
543546
goto evt_end;
544547
}
548+
# ifdef FAN_REPORT_DIR_FID
545549
if (finfo->info_type == FAN_EVENT_INFO_TYPE_DFID_NAME)
546550
file_name = (char *)(file_handle->f_handle + file_handle->handle_bytes);
551+
# endif // FAN_REPORT_DIR_FID
547552

548553
if (ev->mask & (FAN_CREATE|FAN_DELETE|FAN_MOVE))
549554
_fd = &dfd;
@@ -587,6 +592,7 @@ handle_events(int fd, struct c_rule **rules, int sk_fd, int log_fd)
587592
} else
588593
goto evt_end;
589594
}
595+
#endif // FAN_REPORT_FID
590596

591597
for (struct c_rule *rule = *rules; rule;) {
592598
if (rule_pids_check(rule, ev->pid))

0 commit comments

Comments
 (0)