rpm/backport-Use-fd-based-ops-for-metadata-in-FA_TOUCH-mode-too-w.patch
2023-02-28 20:00:58 +08:00

47 lines
1.6 KiB
Diff

From 932013698149d43720cc321c8df2f99f51866e18 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 13 Jan 2023 10:00:37 +0200
Subject: [PATCH] Use fd-based ops for metadata in FA_TOUCH mode too,
when
possible
Fixes another brainfart in commit 25a435e90844ea98fe5eb7bef22c1aecf3a9c033.
---
lib/fsm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/fsm.c b/lib/fsm.c
index 54fea90..e6fac40 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -1002,6 +1002,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
int nodigest = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOFILEDIGEST) ? 1 : 0;
int nofcaps = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCAPS) ? 1 : 0;
int firstlinkfile = -1;
+ int mayopen = 0;
char *tid = NULL;
struct filedata_s *fdata = xcalloc(fc, sizeof(*fdata));
struct filedata_s *firstlink = NULL;
@@ -1136,8 +1137,9 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
rc = RPMERR_UNKNOWN_FILETYPE;
}
+setmeta:
/* Special files require path-based ops */
- int mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
+ mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
if (!rc && fd == -1 && mayopen) {
/* Only follow safe symlinks, and never on temporary files */
fd = fsmOpenat(di.dirfd, fp->fpath,
@@ -1146,7 +1148,6 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
rc = RPMERR_OPEN_FAILED;
}
-setmeta:
if (!rc && fp->setmeta) {
rc = fsmSetmeta(fd, di.dirfd, fp->fpath,
fi, plugins, fp->action,
--
2.27.0