Skip to content

Commit

Permalink
Merge pull request #1767 from lallotta/fix-1638
Browse files Browse the repository at this point in the history
Avoid calling `set_permissions` if the mode is ok
  • Loading branch information
kinnison authored Apr 15, 2019
2 parents 5d1db84 + 5ba85e3 commit ddd7df5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/utils/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,15 @@ pub fn make_executable(path: &Path) -> Result<()> {
path: PathBuf::from(path),
})?;
let mut perms = metadata.permissions();
let new_mode = (perms.mode() & !0o777) | 0o755;
perms.set_mode(new_mode);
let mode = perms.mode();
let new_mode = (mode & !0o777) | 0o755;

// Check if permissions are ok already - #1638
if mode == new_mode {
return Ok(());
}

perms.set_mode(new_mode);
set_permissions(path, perms)
}

Expand Down

0 comments on commit ddd7df5

Please sign in to comment.