[LTP] [PATCH] syscalls/creat09: Add umask(0) to setup

Zhao Gongyi zhaogongyi@huawei.com
Fri Jul 8 02:56:57 CEST 2022


The bit S_ISGID of st_mode is also affected by umask, if umask is 0077,
the test will fail.

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 testcases/kernel/syscalls/creat/creat09.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/creat/creat09.c b/testcases/kernel/syscalls/creat/creat09.c
index bed7bddb0..6edd5dbb9 100644
--- a/testcases/kernel/syscalls/creat/creat09.c
+++ b/testcases/kernel/syscalls/creat/creat09.c
@@ -52,6 +52,8 @@ static void setup(void)
 	struct stat buf;
 	struct passwd *ltpuser = SAFE_GETPWNAM("nobody");

+	umask(0);
+
 	tst_res(TINFO, "User nobody: uid = %d, gid = %d", (int)ltpuser->pw_uid,
 		(int)ltpuser->pw_gid);
 	free_gid = tst_get_free_gid(ltpuser->pw_gid);
--
2.17.1



More information about the ltp mailing list