aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGao Xiang <xiang@kernel.org>2022-01-31 21:17:23 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-01-31 21:17:23 +0000
commit5c95c2e192c9aea501560092fa4cd68eb93e36db (patch)
tree718f31e482ceb9d231045cd25abec1c00aed532f
parent5d356e1bb7b8d3b40e6276dbd8f2020c49653fc3 (diff)
parent07cfac23b2c1dbe6732098391878abe3a7f72a9f (diff)
downloaderofs-utils-5c95c2e192c9aea501560092fa4cd68eb93e36db.tar.gz
UPSTREAM: erofs-utils: fsck: check extract_path in erofsfsck_set_attributes() am: 3e4df222bb am: baf5f6fcf6 am: 07cfac23b2
Original change: https://android-review.googlesource.com/c/platform/external/erofs-utils/+/1966845 Change-Id: I0b66201c4374cefab561a8974d2abbf0d78028bb
-rw-r--r--fsck/main.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fsck/main.c b/fsck/main.c
index 92e0c76..ff7d9fe 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -173,15 +173,17 @@ static void erofsfsck_set_attributes(struct erofs_inode *inode, char *path)
{
int ret;
-#ifdef HAVE_UTIMENSAT
- const struct timespec times[2] = {
- [0] = { .tv_sec = inode->i_ctime,
- .tv_nsec = inode->i_ctime_nsec },
- [1] = { .tv_sec = inode->i_ctime,
- .tv_nsec = inode->i_ctime_nsec },
- };
+ /* don't apply attributes when fsck is used without extraction */
+ if (!fsckcfg.extract_path)
+ return;
- if (utimensat(AT_FDCWD, path, times, AT_SYMLINK_NOFOLLOW) < 0)
+#ifdef HAVE_UTIMENSAT
+ if (utimensat(AT_FDCWD, path, (struct timespec []) {
+ [0] = { .tv_sec = inode->i_ctime,
+ .tv_nsec = inode->i_ctime_nsec },
+ [1] = { .tv_sec = inode->i_ctime,
+ .tv_nsec = inode->i_ctime_nsec },
+ }, AT_SYMLINK_NOFOLLOW) < 0)
#else
if (utime(path, &((struct utimbuf){.actime = inode->i_ctime,
.modtime = inode->i_ctime})) < 0)
@@ -665,7 +667,7 @@ verify:
ret = erofs_iterate_dir(&ctx, true);
}
- if (!ret && fsckcfg.extract_path)
+ if (!ret)
erofsfsck_set_attributes(&inode, fsckcfg.extract_path);
out: