[LTP] [PATCH v2 2/2] syscalls/uname02: Convert to new API and cleanup
Cyril Hrubis
chrubis@suse.cz
Thu Nov 12 11:17:26 CET 2020
Hi!
Pushed with minor changes, thanks.
I've added a check for the invalid return value and got rid of the cast
since void* does not need it.
diff --git a/testcases/kernel/syscalls/uname/uname02.c b/testcases/kernel/syscalls/uname/uname02.c
index 09c26939e..1903dae24 100644
--- a/testcases/kernel/syscalls/uname/uname02.c
+++ b/testcases/kernel/syscalls/uname/uname02.c
@@ -16,12 +16,17 @@ static void *bad_addr;
static void verify_uname(void)
{
- TEST(uname((struct utsname *)bad_addr));
+ TEST(uname(bad_addr));
if (TST_RET == 0) {
tst_res(TFAIL, "uname() succeed when failure expected");
return;
}
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "Invalid uname() return value %ld", TST_RET);
+ return;
+ }
+
if (TST_ERR == EFAULT)
tst_res(TPASS, "uname() got EFAULT as expected");
else
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list