[LTP] [PATCH 2/2] userns03: Use correct macro

Petr Vorel pvorel@suse.cz
Fri Jul 21 16:35:55 CEST 2023


TST_EXP_FAIL2() must be used for write(), as not only 0 would be a
failure, but also >= 0 (the number of written bytes).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/containers/userns/userns03.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/containers/userns/userns03.c b/testcases/kernel/containers/userns/userns03.c
index 4dd3f1a73..a7f12e3d9 100644
--- a/testcases/kernel/containers/userns/userns03.c
+++ b/testcases/kernel/containers/userns/userns03.c
@@ -156,7 +156,7 @@ static void run(void)
 		tst_res(TINFO, "Check if setgroups can be re-enabled");
 
 		fd = SAFE_OPEN(path, O_WRONLY, 0644);
-		TST_EXP_FAIL(write(fd, "allow", 5), EPERM);
+		TST_EXP_FAIL2(write(fd, "allow", 5), EPERM);
 		SAFE_CLOSE(fd);
 
 		sprintf(path, "/proc/%d/setgroups", cpid2);
-- 
2.40.1



More information about the ltp mailing list