From 9213744ecbdf3c9aac0f9dea4c12b0a546f53076 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 9 Feb 2021 12:58:47 +0100 Subject: [PATCH] fix #3026: pxar: metadata: apply flags _after_ updating mtime otherwise we'll fail to update the mtime of immutable files Signed-off-by: Wolfgang Bumiller --- src/pxar/metadata.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pxar/metadata.rs b/src/pxar/metadata.rs index 12a89cbe..8d24d85f 100644 --- a/src/pxar/metadata.rs +++ b/src/pxar/metadata.rs @@ -133,10 +133,6 @@ pub fn apply( .or_else(&mut *on_error)?; } - if metadata.stat.flags != 0 { - apply_flags(flags, fd, metadata.stat.flags).or_else(&mut *on_error)?; - } - let res = c_result!(unsafe { libc::utimensat( libc::AT_FDCWD, @@ -157,6 +153,10 @@ pub fn apply( } } + if metadata.stat.flags != 0 { + apply_flags(flags, fd, metadata.stat.flags).or_else(&mut *on_error)?; + } + Ok(()) }