Skip to content

Commit

Permalink
TemporaryFile - set umask before creation
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Nov 13, 2024
1 parent 010d0c1 commit 1836a5f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crypto/test/file_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ bool TemporaryFile::Init(bssl::Span<const uint8_t> content) {
#else
std::string path = temp_dir + "bssl_tmp_file.XXXXXX";
// TODO(davidben): Use |path.data()| when we require C++17.
mode_t prev_umask = umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
int fd = mkstemp(&path[0]);
umask(prev_umask);
if (fd < 0) {
perror("Could not create temporary file");
return false;
Expand Down

0 comments on commit 1836a5f

Please sign in to comment.