Skip to content

Commit f77d37c

Browse files
committed
linuxulator: Return EINVAL for invalid inotify flags
We implement all of the currently-defined Linux inotify mask bits and flags, with the same values as Linux. Return EINVAL for unknown bits, as Linux does. This also moves the translation inline into linux_inotify_add_watch. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57387
1 parent 68004e5 commit f77d37c

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

‎sys/compat/linux/linux_file.c‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,23 +2034,17 @@ _Static_assert(LINUX_IN_ONESHOT == IN_ONESHOT,
20342034
_Static_assert(LINUX_IN_EXCL_UNLINK == IN_EXCL_UNLINK,
20352035
"IN_EXCL_UNLINK mismatch");
20362036

2037-
static int
2038-
linux_inotify_watch_flags(int l_flags)
2039-
{
2040-
if ((l_flags & ~(LINUX_IN_ALL_EVENTS | LINUX_IN_ALL_FLAGS)) != 0) {
2041-
linux_msg(NULL, "inotify_add_watch unsupported flags 0x%x",
2042-
l_flags);
2043-
}
2044-
2045-
return (l_flags);
2046-
}
2047-
20482037
int
20492038
linux_inotify_add_watch(struct thread *td,
20502039
struct linux_inotify_add_watch_args *args)
20512040
{
2041+
if ((args->mask & ~(LINUX_IN_ALL_EVENTS | LINUX_IN_ALL_FLAGS)) != 0) {
2042+
linux_msg(NULL, "inotify_add_watch unsupported flags 0x%x",
2043+
args->mask);
2044+
return (EINVAL);
2045+
}
20522046
return (kern_inotify_add_watch(args->fd, AT_FDCWD, args->pathname,
2053-
linux_inotify_watch_flags(args->mask), td));
2047+
args->mask, td));
20542048
}
20552049

20562050
int

0 commit comments

Comments
 (0)