[LTP] [PATCH v3 2/3] syscalls/fstat: Fix bug caused by default umask

Zou Wei zou_wei@huawei.com
Mon Mar 30 09:27:48 CEST 2020


v3:
The case is only successful when system default umask is 0022.
When default umask is 0077 or other values, should clear current umask by umask(0) in setup().

Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 testcases/kernel/syscalls/fstat/fstat02.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/fstat/fstat02.c b/testcases/kernel/syscalls/fstat/fstat02.c
index 4744560..c0229de 100644
--- a/testcases/kernel/syscalls/fstat/fstat02.c
+++ b/testcases/kernel/syscalls/fstat/fstat02.c
@@ -72,6 +72,8 @@ static void setup(void)
 	user_id  = getuid();
 	group_id = getgid();

+	umask(0);
+
 	fildes = SAFE_OPEN(TESTFILE, O_WRONLY | O_CREAT, FILE_MODE);

 	if (tst_fill_file(TESTFILE, 'a', FILE_SIZE, 1))
--
2.6.2



More information about the ltp mailing list