summaryrefslogtreecommitdiff
path: root/backport-Use-fd-based-ops-for-metadata-in-FA_TOUCH-mode-too-w.patch
blob: c537632cdf93fbe43ad8273d43f5499dfab7e61b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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(fp->fpath, fi, plugins, fp->action,
 				&fp->sb, nofcaps);
-- 
2.27.0