]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (mkfds) add / and /etc/fstab as the monitoring targets to inotify
authorMasatake YAMATO <yamato@redhat.com>
Fri, 9 Jun 2023 10:02:25 +0000 (19:02 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Tue, 13 Jun 2023 10:18:54 +0000 (19:18 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
tests/helpers/test_mkfds.c

index 0afb9624855585836daa731442cb79cb6575bb33..ff6e930874968fe9766a61899bb0d6cfd0eebdfe 100644 (file)
@@ -823,6 +823,20 @@ static void *make_inotify_fd(const struct factory *factory _U_, struct fdesc fde
        if (fd < 0)
                err(EXIT_FAILURE, "failed in inotify_init()");
 
+       if (inotify_add_watch(fd, "/", IN_DELETE) < 0) {
+               int e = errno;
+               close(fd);
+               errno = e;
+               err(EXIT_FAILURE, "failed in inotify_add_watch(\"/\")");
+       }
+
+       if (inotify_add_watch(fd, "/etc/fstab", IN_DELETE) < 0) {
+               int e = errno;
+               close(fd);
+               errno = e;
+               err(EXIT_FAILURE, "failed in inotify_add_watch(\"/etc/fstab\")");
+       }
+
        if (fd != fdescs[0].fd) {
                if (dup2(fd, fdescs[0].fd) < 0) {
                        int e = errno;