pxar: skip write_attr_fd if they are equal

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-02-09 13:08:18 +01:00
parent 9213744ecb
commit ab6cd4229b
1 changed files with 5 additions and 0 deletions

View File

@ -363,6 +363,11 @@ fn apply_chattr(fd: RawFd, chattr: libc::c_long, mask: libc::c_long) -> Result<(
}
let attr = (chattr & mask) | (fattr & !mask);
if attr == fattr {
return Ok(());
}
match unsafe { fs::write_attr_fd(fd, &attr) } {
Ok(_) => Ok(()),
Err(nix::Error::Sys(errno)) if errno_is_unsupported(errno) => Ok(()),