fix feature flag logic in pxar create

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-03-12 10:00:34 +01:00
parent e8913fea12
commit 591b120d35
2 changed files with 16 additions and 16 deletions

View File

@ -130,22 +130,22 @@ fn extract_archive(
) -> Result<(), Error> { ) -> Result<(), Error> {
let mut feature_flags = Flags::DEFAULT; let mut feature_flags = Flags::DEFAULT;
if no_xattrs { if no_xattrs {
feature_flags ^= Flags::WITH_XATTRS; feature_flags.remove(Flags::WITH_XATTRS);
} }
if no_fcaps { if no_fcaps {
feature_flags ^= Flags::WITH_FCAPS; feature_flags.remove(Flags::WITH_FCAPS);
} }
if no_acls { if no_acls {
feature_flags ^= Flags::WITH_ACL; feature_flags.remove(Flags::WITH_ACL);
} }
if no_device_nodes { if no_device_nodes {
feature_flags ^= Flags::WITH_DEVICE_NODES; feature_flags.remove(Flags::WITH_DEVICE_NODES);
} }
if no_fifos { if no_fifos {
feature_flags ^= Flags::WITH_FIFOS; feature_flags.remove(Flags::WITH_FIFOS);
} }
if no_sockets { if no_sockets {
feature_flags ^= Flags::WITH_SOCKETS; feature_flags.remove(Flags::WITH_SOCKETS);
} }
let pattern = pattern.unwrap_or_else(Vec::new); let pattern = pattern.unwrap_or_else(Vec::new);
@ -353,22 +353,22 @@ async fn create_archive(
let writer = std::io::BufWriter::with_capacity(1024 * 1024, file); let writer = std::io::BufWriter::with_capacity(1024 * 1024, file);
let mut feature_flags = Flags::DEFAULT; let mut feature_flags = Flags::DEFAULT;
if no_xattrs { if no_xattrs {
feature_flags ^= Flags::WITH_XATTRS; feature_flags.remove(Flags::WITH_XATTRS);
} }
if no_fcaps { if no_fcaps {
feature_flags ^= Flags::WITH_FCAPS; feature_flags.remove(Flags::WITH_FCAPS);
} }
if no_acls { if no_acls {
feature_flags ^= Flags::WITH_ACL; feature_flags.remove(Flags::WITH_ACL);
} }
if no_device_nodes { if no_device_nodes {
feature_flags ^= Flags::WITH_DEVICE_NODES; feature_flags.remove(Flags::WITH_DEVICE_NODES);
} }
if no_fifos { if no_fifos {
feature_flags ^= Flags::WITH_FIFOS; feature_flags.remove(Flags::WITH_FIFOS);
} }
if no_sockets { if no_sockets {
feature_flags ^= Flags::WITH_SOCKETS; feature_flags.remove(Flags::WITH_SOCKETS);
} }
let writer = pxar::encoder::sync::StandardWriter::new(writer); let writer = pxar::encoder::sync::StandardWriter::new(writer);

View File

@ -768,7 +768,7 @@ fn get_metadata(fd: RawFd, stat: &FileStat, flags: Flags, fs_magic: i64) -> Resu
} }
fn get_fcaps(meta: &mut Metadata, fd: RawFd, flags: Flags) -> Result<(), Error> { fn get_fcaps(meta: &mut Metadata, fd: RawFd, flags: Flags) -> Result<(), Error> {
if flags.contains(Flags::WITH_FCAPS) { if !flags.contains(Flags::WITH_FCAPS) {
return Ok(()); return Ok(());
} }
@ -790,7 +790,7 @@ fn get_xattr_fcaps_acl(
proc_path: &Path, proc_path: &Path,
flags: Flags, flags: Flags,
) -> Result<(), Error> { ) -> Result<(), Error> {
if flags.contains(Flags::WITH_XATTRS) { if !flags.contains(Flags::WITH_XATTRS) {
return Ok(()); return Ok(());
} }
@ -879,7 +879,7 @@ fn get_quota_project_id(
return Ok(()); return Ok(());
} }
if flags.contains(Flags::WITH_QUOTA_PROJID) { if !flags.contains(Flags::WITH_QUOTA_PROJID) {
return Ok(()); return Ok(());
} }
@ -914,7 +914,7 @@ fn get_quota_project_id(
} }
fn get_acl(metadata: &mut Metadata, proc_path: &Path, flags: Flags) -> Result<(), Error> { fn get_acl(metadata: &mut Metadata, proc_path: &Path, flags: Flags) -> Result<(), Error> {
if flags.contains(Flags::WITH_ACL) { if !flags.contains(Flags::WITH_ACL) {
return Ok(()); return Ok(());
} }