mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 22:42:41 +01:00
Merge pull request #13526 from philiptaron/issue-12786/canonicaliseTimestampAndPermissions-on-dir-better
libstore: always canonicalize directory permissions
This commit is contained in:
commit
55f6ff36c2
1 changed files with 3 additions and 3 deletions
|
|
@ -21,9 +21,9 @@ static void canonicaliseTimestampAndPermissions(const Path & path, const struct
|
|||
|
||||
/* Mask out all type related bits. */
|
||||
mode_t mode = st.st_mode & ~S_IFMT;
|
||||
|
||||
if (mode != 0444 && mode != 0555) {
|
||||
mode = (st.st_mode & S_IFMT) | 0444 | (st.st_mode & S_IXUSR ? 0111 : 0);
|
||||
bool isDir = S_ISDIR(st.st_mode);
|
||||
if ((mode != 0444 || isDir) && mode != 0555) {
|
||||
mode = (st.st_mode & S_IFMT) | 0444 | (st.st_mode & S_IXUSR || isDir ? 0111 : 0);
|
||||
if (chmod(path.c_str(), mode) == -1)
|
||||
throw SysError("changing mode of '%1%' to %2$o", path, mode);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue