diff mbox series

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

Message ID 1645519272-2733-4-git-send-email-xuyang2018.jy@fujitsu.com
State Accepted
Headers show
Series [v3,1/7] Merge multiple pidfd*.h into one header | expand

Commit Message

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

Comments

Cyril Hrubis Feb. 23, 2022, 1:29 p.m. UTC | #1
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
diff mbox series

Patch

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) {