syscalls/chdir01: Add umask before mkdir
PATCH 1/1 syscalls/chdir01: Add umask before mkdir
When uid is nobody, umask is not 022, the test process might has not permmission to access the file which created by SAFE_MKDIR with mode 0755.
Signed-off-by Zhao Gongyi <[email protected]>
--- testcases/kernel/syscalls/chdir/chdir01.c | 9 +++++++++ 1 file changed, 9 insertions(+)
testcases/kernel/syscalls/chdir/chdir01.c +9 -0
@@ -13,6 +13,7 @@#include <stdio.h> #include <stdlib.h> #include <sys/types.h> +#include <sys/stat.h> #include <unistd.h> #include <pwd.h>
@@ -55,6 +56,14 @@ static void setup(void)sprintf (workdir,"%s/%s" , cwd,MNTPOINT );free (cwd);SAFE_CHDIR (workdir); + +/* +* When uid is nobody, umask is not 022, the test process might +* has not permmission to access the file which created by SAFE_MKDIR +* with mode 0755. +*/ +umask (022 ); +SAFE_MKDIR (DIR_NAME ,0755 );SAFE_MKDIR (BLOCKED_NAME ,0644 );
--
2.17.1
PATCH 1/1 syscalls/chdir01: Add umask before mkdir
Quoted 1 line
When uid is nobody, umask is not 022, the test process might
Not sure if I understand "When uid is nobody, umask is not 022", umask setup depends usually on the system. I wonder which system has different setup for nobody.
BTW later was posted another solution, see my comments there.
Kind regards,
Petr
[2] https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
Quoted 2 lines
has not permmission to access the file which created by
SAFE_MKDIRwith mode 0755.