[LTP] [COMMITTED][PATCH 1/1] fanotify22: Add missing name_to_handle_at() guard

Petr Vorel pvorel@suse.cz
Thu Jan 13 20:14:29 CET 2022


That fixes build on uclibc < v1.0.35, which does not have
name_to_handle_at() which is required for fanotify_get_fid() helper.

+ remove include <fcntl.h> (included in lapi/fcntl.h via fanotify.h)

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,

simple pre-release fix.

FYI after release I'll post name_to_handle_at() syscall wrapper for
toolchains without it (people use new kernel just don't have wrapper in
slightly older uclibc).

Kind regards,
Petr

 testcases/kernel/syscalls/fanotify/fanotify22.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/fanotify/fanotify22.c b/testcases/kernel/syscalls/fanotify/fanotify22.c
index fd1c3fbbb9..bd82fbf63d 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify22.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify22.c
@@ -29,7 +29,6 @@
 #include "tst_test.h"
 #include <sys/fanotify.h>
 #include <sys/types.h>
-#include <fcntl.h>
 
 #ifdef HAVE_SYS_FANOTIFY_H
 #include "fanotify.h"
@@ -39,13 +38,16 @@
 #endif
 
 #define BUF_SIZE 256
-static char event_buf[BUF_SIZE];
-int fd_notify;
 
 #define MOUNT_PATH "test_mnt"
 #define BASE_DIR "internal_dir"
 #define BAD_DIR BASE_DIR"/bad_dir"
 
+#ifdef HAVE_NAME_TO_HANDLE_AT
+
+static char event_buf[BUF_SIZE];
+int fd_notify;
+
 /* These expected FIDs are common to multiple tests */
 static struct fanotify_fid_t null_fid;
 static struct fanotify_fid_t bad_file_fid;
@@ -309,6 +311,9 @@ static struct tst_test test = {
 	}
 };
 
+#else
+	TST_TEST_TCONF("system does not have required name_to_handle_at() support");
+#endif
 #else
 	TST_TEST_TCONF("system doesn't have required fanotify support");
 #endif
-- 
2.34.1



More information about the ltp mailing list