[LTP] [PATCH v3 4/7] syscalls/fanotify21: Make use of SAFE_PIDFD_OPEN

Yang Xu xuyang2018.jy@fujitsu.com
Tue Feb 22 09:41:09 CET 2022


Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/fanotify/fanotify21.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/testcases/kernel/syscalls/fanotify/fanotify21.c b/testcases/kernel/syscalls/fanotify/fanotify21.c
index bd6429ab5..d5be3e270 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify21.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify21.c
@@ -23,7 +23,7 @@
 #include <string.h>
 #include "tst_test.h"
 #include "tst_safe_stdio.h"
-#include "lapi/pidfd.h"
+#include "tst_safe_pidfd.h"
 
 #ifdef HAVE_SYS_FANOTIFY_H
 #include "fanotify.h"
@@ -124,12 +124,7 @@ static void do_setup(void)
 	SAFE_FANOTIFY_MARK(fanotify_fd, FAN_MARK_ADD, FAN_OPEN, AT_FDCWD,
 			   TEST_FILE);
 
-	pidfd = pidfd_open(getpid(), 0);
-	if (pidfd < 0) {
-		tst_brk(TBROK | TERRNO,
-			"pidfd=%d, pidfd_open(%d, 0) failed",
-			pidfd, getpid());
-	}
+	pidfd = SAFE_PIDFD_OPEN(getpid(), 0);
 
 	self_pidfd_fdinfo = read_pidfd_fdinfo(pidfd);
 	if (self_pidfd_fdinfo == NULL) {
-- 
2.31.1



More information about the ltp mailing list