From de2791868a2a1cb87be044115447eca09b22417a Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Thu, 22 Aug 2019 15:36:26 +0200 Subject: [PATCH] src/pxar/sequentail_decoder.rs: followup: cleanup S_IFMT masking Signed-off-by: Christian Ebner Signed-off-by: Wolfgang Bumiller --- src/pxar/sequential_decoder.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pxar/sequential_decoder.rs b/src/pxar/sequential_decoder.rs index 7a5d47ea..cd8d5b70 100644 --- a/src/pxar/sequential_decoder.rs +++ b/src/pxar/sequential_decoder.rs @@ -804,6 +804,7 @@ impl Result<(), Error>> SequentialDecoder { check_ca_header::(&head, PXAR_ENTRY)?; let entry: PxarEntry = self.read_item()?; + let ifmt = entry.mode as u32 & libc::S_IFMT; let mut child_pattern = Vec::new(); // If parent was a match, then children should be assumed to match too @@ -811,11 +812,7 @@ impl Result<(), Error>> SequentialDecoder { // there are no match pattern. let mut matched = parent_matched; if match_pattern.len() > 0 { - match match_filename( - filename, - entry.mode as u32 & libc::S_IFMT == libc::S_IFDIR, - match_pattern, - )? { + match match_filename(filename, ifmt == libc::S_IFDIR, match_pattern)? { (MatchType::None, _) => matched = MatchType::None, (MatchType::Negative, _) => matched = MatchType::Negative, (match_type, pattern) => { @@ -835,7 +832,7 @@ impl Result<(), Error>> SequentialDecoder { (self.callback)(&full_path)?; } - match entry.mode as u32 & libc::S_IFMT { + match ifmt { libc::S_IFDIR => { self.restore_dir(base_path, dirs, entry, &filename, matched, &child_pattern) }