public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] syscalls/open01.c: Don't continue when open() failed
@ 2021-01-04 12:54 Xiao Yang
  2021-01-04 12:54 ` [LTP] [RFC PATCH 2/2] include/tst_test_macros.h: Report TINFO when TST_EXP_FD() succeeded Xiao Yang
  2021-01-05 13:15 ` [LTP] [PATCH 1/2] syscalls/open01.c: Don't continue when open() failed Cyril Hrubis
  0 siblings, 2 replies; 13+ messages in thread
From: Xiao Yang @ 2021-01-04 12:54 UTC (permalink / raw)
  To: ltp

Avoid calling fstat() with invalid fd:
-------------------------------------------
./open01
...
open01.c:53: TBROK: fstat(-1,0x7fff731410a0) failed: EBADF (9)
-------------------------------------------

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 testcases/kernel/syscalls/open/open01.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/syscalls/open/open01.c b/testcases/kernel/syscalls/open/open01.c
index 1172f832b..2f0ad550a 100644
--- a/testcases/kernel/syscalls/open/open01.c
+++ b/testcases/kernel/syscalls/open/open01.c
@@ -47,6 +47,9 @@ static void verify_open(unsigned int n)
 
 	TST_EXP_FD(open(tc->filename, tc->flag, tc->mode),
 	           "open() with %s", tc->desc);
+	if (!TST_PASS)
+		return;
+
 	fd = TST_RET;
 
 	SAFE_FSTAT(fd, &buf);
-- 
2.21.0




^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-01-11 14:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-04 12:54 [LTP] [PATCH 1/2] syscalls/open01.c: Don't continue when open() failed Xiao Yang
2021-01-04 12:54 ` [LTP] [RFC PATCH 2/2] include/tst_test_macros.h: Report TINFO when TST_EXP_FD() succeeded Xiao Yang
2021-01-04 13:07   ` yangx.jy
2021-01-05 13:38     ` Cyril Hrubis
2021-01-05 13:36   ` Cyril Hrubis
2021-01-05 14:39     ` yangx.jy
2021-01-05 15:03       ` Cyril Hrubis
2021-01-10 13:04         ` [LTP] [RFC PATCH v2 1/2] include/tst_test_macros.h: Add TST_EXP_SILENT_{PASS, FD} macros Xiao Yang
2021-01-10 13:04           ` [LTP] [RFC PATCH v2 2/2] syscalls/access02.c: Take use of TST_EXP_SILENT_PASS Xiao Yang
2021-01-11 14:07           ` [LTP] [RFC PATCH v2 1/2] include/tst_test_macros.h: Add TST_EXP_SILENT_{PASS, FD} macros Cyril Hrubis
2021-01-10 13:48         ` [LTP] [RFC PATCH 2/2] include/tst_test_macros.h: Report TINFO when TST_EXP_FD() succeeded yangx.jy
2021-01-05 13:15 ` [LTP] [PATCH 1/2] syscalls/open01.c: Don't continue when open() failed Cyril Hrubis
2021-01-05 14:20   ` yangx.jy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox