Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid calling set_permissions if the mode is ok #1767

Merged
merged 1 commit into from
Apr 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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