Skip to contentSkip to conversation

fanotify22: Add missing name_to_handle_at() guard

PATCH New Petr Vorel 1 participant 1 message Jan 13, 2022

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 fanotify22: Add missing name_to_handle_at() guard

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)

---
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(-)
testcases/kernel/syscalls/fanotify/fanotify22.c +8 -3
index fd1c3fbbb9..bd82fbf63d 100644
@@ -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
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp