syscalls/chdir: bugfix for syscalls/chdir/chdir01.c
PATCH 1/1 syscalls/chdir: bugfix for syscalls/chdir/chdir01.c
Add umask(0) before SAFE_MKDIR(DIR_NAME, 0755) to prevent the unexpected case failure when the system umask is set to some values, such as 0077.
--- testcases/kernel/syscalls/chdir/chdir01.c | 3 +++ 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/chdir/chdir01.c +3 -0
@@ -55,8 +55,11 @@ static void setup(void)sprintf (workdir,"%s/%s" , cwd,MNTPOINT );free (cwd);SAFE_CHDIR (workdir); + +mode_t sys_umask =umask (0 );SAFE_MKDIR (DIR_NAME ,0755 );SAFE_MKDIR (BLOCKED_NAME ,0644 ); +umask (sys_umask);/* FAT and NTFS override file and directory permissions */ SAFE_STAT (BLOCKED_NAME , &statbuf);
--
2.17.1
PATCH 1/1 syscalls/chdir: bugfix for syscalls/chdir/chdir01.c
Hi,
NOTE, there was already another solution posted before [1].
I slightly prefer this one as it reverts back previous setup, which is a good habit, but no hard feeling because it's probably not needed in this case.
I wonder what I'm missing, because although I set system umask 222 (in /etc/pam.d/common-session and verified it's working) I was not able to trigger any problem.
Kind regards,
Petr
[1] https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
PATCH 1/1 syscalls/chdir: bugfix for syscalls/chdir/chdir01.c
In reply to Xie ZiyaoHi Ziyao,
thanks, merged!
Kind regards,
Petr