Skip to content

Commit

Permalink
samples: Fix warning in fsnotify sample
Browse files Browse the repository at this point in the history
The fsnotify sample code generates the following warning on powerpc:

samples/fanotify/fs-monitor.c: In function 'handle_notifications':
samples/fanotify/fs-monitor.c:68:36: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long unsigned int'} [-Wformat=]
   68 |    printf("unexpected FAN MARK: %llx\n", event->mask);
      |                                 ~~~^     ~~~~~~~~~~~
      |                                    |          |
      |                                    |          __u64 {aka long unsigned int}
      |                                    long long unsigned int
      |                                 %lx

Fix the problem by explicitely typing the argument to proper type.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Nov 1, 2021
1 parent 9abeae5 commit b7eccf7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion samples/fanotify/fs-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ static void handle_notifications(char *buffer, int len)
for (; FAN_EVENT_OK(event, len); event = FAN_EVENT_NEXT(event, len)) {

if (event->mask != FAN_FS_ERROR) {
printf("unexpected FAN MARK: %llx\n", event->mask);
printf("unexpected FAN MARK: %llx\n",
(unsigned long long)event->mask);
goto next_event;
}

Expand Down

0 comments on commit b7eccf7

Please sign in to comment.