1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

uu_install: check for permission change on -C option

This commit is contained in:
Niyaz Nigmatullin 2022-06-22 19:55:26 +03:00
parent 5262c043f3
commit b22d2470ac

View file

@ -757,6 +757,8 @@ fn need_copy(from: &Path, to: &Path, b: &Behavior) -> UResult<bool> {
// setuid || setgid || sticky
let extra_mode: u32 = 0o7000;
// setuid || setgid || sticky || permissions
let all_modes: u32 = 0o7777;
if b.specified_mode.unwrap_or(0) & extra_mode != 0
|| from_meta.mode() & extra_mode != 0
@ -764,6 +766,9 @@ fn need_copy(from: &Path, to: &Path, b: &Behavior) -> UResult<bool> {
{
return Ok(true);
}
if b.mode() != to_meta.mode() & all_modes {
return Ok(true);
}
if !from_meta.is_file() || !to_meta.is_file() {
return Ok(true);