File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -87,3 +87,29 @@ void test_core_futils__recursive_rmdir_keeps_symlink_targets(void)
8787 cl_must_pass (p_rmdir ("dir-target" ));
8888 cl_must_pass (p_unlink ("file-target" ));
8989}
90+
91+ void test_core_futils__mktmp_umask (void )
92+ {
93+ #ifdef GIT_WIN32
94+ cl_skip ();
95+ #else
96+ git_str path = GIT_STR_INIT ;
97+ struct stat st ;
98+ int fd ;
99+
100+ umask (0 );
101+ cl_assert ((fd = git_futils_mktmp (& path , "foo" , 0777 )) >= 0 );
102+ cl_must_pass (p_fstat (fd , & st ));
103+ cl_assert_equal_i (st .st_mode & 0777 , 0777 );
104+ cl_must_pass (p_unlink (path .ptr ));
105+ close (fd );
106+
107+ umask (077 );
108+ cl_assert ((fd = git_futils_mktmp (& path , "foo" , 0777 )) >= 0 );
109+ cl_must_pass (p_fstat (fd , & st ));
110+ cl_assert_equal_i (st .st_mode & 0777 , 0700 );
111+ cl_must_pass (p_unlink (path .ptr ));
112+ close (fd );
113+ git_str_dispose (& path );
114+ #endif
115+ }
You can’t perform that action at this time.
0 commit comments