[LTP] [PATCH v1] statx07.c: set umask to 0 within setup

Wei Gao wegao@suse.com
Sun Mar 3 11:31:05 CET 2024


When system's default umask is 0077, this will trigger following issues:
statx07.c:108: TFAIL: statx() with AT_STATX_DONT_SYNC for mode 644 600

Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/kernel/syscalls/statx/statx07.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/syscalls/statx/statx07.c b/testcases/kernel/syscalls/statx/statx07.c
index 4dbf83e18..1a568ec9e 100644
--- a/testcases/kernel/syscalls/statx/statx07.c
+++ b/testcases/kernel/syscalls/statx/statx07.c
@@ -118,11 +118,15 @@ static void setup(void)
 
 	cwd = tst_get_tmpdir();
 
+	mode_t old_umask = umask(0);
+
 	SAFE_MKDIR(SERV_PATH, DEFAULT_MODE);
 	SAFE_MKDIR(CLI_PATH, DEFAULT_MODE);
 	SAFE_CREAT(SERV_FORCE_SYNC, DEFAULT_MODE);
 	SAFE_CREAT(SERV_DONT_SYNC, DEFAULT_MODE);
 
+	umask(old_umask);
+
 	snprintf(server_path, sizeof(server_path), ":%s/%s", cwd, SERV_PATH);
 
 	snprintf(cmd, sizeof(cmd),
-- 
2.35.3



More information about the ltp mailing list