Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
8d548222
Commit
8d548222
authored
Jan 14, 2022
by
Peter Pettersson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: verify that futils_mktmp respects umask
parent
e2e3f3e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
tests/core/futils.c
+26
-0
No files found.
tests/core/futils.c
View file @
8d548222
...
...
@@ -87,3 +87,29 @@ void test_core_futils__recursive_rmdir_keeps_symlink_targets(void)
cl_must_pass
(
p_rmdir
(
"dir-target"
));
cl_must_pass
(
p_unlink
(
"file-target"
));
}
void
test_core_futils__mktmp_umask
(
void
)
{
#ifdef GIT_WIN32
cl_skip
();
#else
git_str
path
=
GIT_STR_INIT
;
struct
stat
st
;
int
fd
;
umask
(
0
);
cl_assert
((
fd
=
git_futils_mktmp
(
&
path
,
"foo"
,
0777
))
>=
0
);
cl_must_pass
(
p_fstat
(
fd
,
&
st
));
cl_assert_equal_i
(
st
.
st_mode
&
0777
,
0777
);
cl_must_pass
(
p_unlink
(
path
.
ptr
));
close
(
fd
);
umask
(
077
);
cl_assert
((
fd
=
git_futils_mktmp
(
&
path
,
"foo"
,
0777
))
>=
0
);
cl_must_pass
(
p_fstat
(
fd
,
&
st
));
cl_assert_equal_i
(
st
.
st_mode
&
0777
,
0700
);
cl_must_pass
(
p_unlink
(
path
.
ptr
));
close
(
fd
);
git_str_dispose
(
&
path
);
#endif
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment