* [PATCH] erofs-utils: fsck: check extract_path in erofsfsck_set_attributes()
@ 2022-01-29 7:45 Gao Xiang
0 siblings, 0 replies; only message in thread
From: Gao Xiang @ 2022-01-29 7:45 UTC (permalink / raw)
To: linux-erofs
Just cleanup.
Signed-off-by: Gao Xiang <xiang@kernel.org>
---
fsck/main.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/fsck/main.c b/fsck/main.c
index a906ee85cf7a..42f7751be1ee 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -219,15 +219,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)
@@ -711,7 +713,7 @@ verify:
ret = erofs_iterate_dir(&ctx, true);
}
- if (!ret && fsckcfg.extract_path)
+ if (!ret)
erofsfsck_set_attributes(&inode, fsckcfg.extract_path);
out:
--
2.20.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-29 7:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-29 7:45 [PATCH] erofs-utils: fsck: check extract_path in erofsfsck_set_attributes() Gao Xiang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.