Merge pull request #22407 from hrydgard/createdir-0775

Create directories with 775 permissions instead of 755.
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2026-10-01 10:20:52 -06:00
commit c85d8eea00
1 file changed
+8 -1
+8 -1
View File
@@ -703,7 +703,9 @@ bool CreateDir(const Path &path, bool quiet) {
}
return false;
#else
if (mkdir(path.ToString().c_str(), 0755) == 0) {
if (mkdir(path.ToString().c_str(), 0775) == 0) {
// mkdir's mode is masked by the umask, chmod's isn't.
chmod(path.ToString().c_str(), 0775);
return true;
}
@@ -712,6 +714,11 @@ bool CreateDir(const Path &path, bool quiet) {
if (!quiet) {
DEBUG_LOG(Log::IO, "CreateDir: mkdir failed on %s: already exists", path.c_str());
}
// Repair directories created with older, narrower permissions.
struct stat info;
if (stat(path.c_str(), &info) == 0 && S_ISDIR(info.st_mode)) {
chmod(path.c_str(), 0775);
}
return true;
}