parent
693d9a4861
commit
c859e8ab5f
10
src/file.cc
10
src/file.cc
|
@ -304,8 +304,14 @@ void make_directory(StringView dir)
|
||||||
if (not S_ISDIR(st.st_mode))
|
if (not S_ISDIR(st.st_mode))
|
||||||
throw runtime_error(format("Cannot make directory, '{}' exists but is not a directory", dirname));
|
throw runtime_error(format("Cannot make directory, '{}' exists but is not a directory", dirname));
|
||||||
}
|
}
|
||||||
else if (mkdir(dirname.zstr(), S_IRWXU) != 0)
|
else
|
||||||
throw runtime_error(format("mkdir failed for directory '{}' errno {}", dirname, errno));
|
{
|
||||||
|
auto old_mask = umask(0);
|
||||||
|
auto restore_mask = on_scope_end([old_mask]() { umask(old_mask); });
|
||||||
|
|
||||||
|
if (mkdir(dirname.zstr(), S_IRWXU | S_IRWXG | S_IRWXO) != 0)
|
||||||
|
throw runtime_error(format("mkdir failed for directory '{}' errno {}", dirname, errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user