71 lines
2.1 KiB
Diff
71 lines
2.1 KiB
Diff
From 073bcf7ff6d580e5bafee0ef762cf7ce71bc486d Mon Sep 17 00:00:00 2001
|
|
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Date: Mon, 8 Feb 2021 10:45:59 +0200
|
|
Subject: [PATCH] Clean up file unpack iteration logic a bit
|
|
|
|
Conflict:NA
|
|
Reference:https://github.com/rpm-software-management/rpm/commit/073bcf7ff6d580e5bafee0ef762cf7ce71bc486d
|
|
|
|
Handle rpmfiNext() in the while-condition directly to make it more like
|
|
similar other constructs elsewhere, adjust for the end of iteration
|
|
code after the loop. Also take the file index from rpmfiNext() so
|
|
we don't need multiple calls to rpmfiFX() later.
|
|
---
|
|
lib/fsm.c | 19 +++++++------------
|
|
1 file changed, 7 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/lib/fsm.c b/lib/fsm.c
|
|
index 35dcda081..7c291adb0 100644
|
|
--- a/lib/fsm.c
|
|
+++ b/lib/fsm.c
|
|
@@ -841,6 +841,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
|
|
struct stat sb;
|
|
int saveerrno = errno;
|
|
int rc = 0;
|
|
+ int fx = -1;
|
|
int nodigest = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOFILEDIGEST) ? 1 : 0;
|
|
int nofcaps = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCAPS) ? 1 : 0;
|
|
int firsthardlink = -1;
|
|
@@ -862,17 +863,8 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
|
|
/* Detect and create directories not explicitly in package. */
|
|
rc = fsmMkdirs(files, fs, plugins);
|
|
|
|
- while (!rc) {
|
|
- /* Read next payload header. */
|
|
- rc = rpmfiNext(fi);
|
|
-
|
|
- if (rc < 0) {
|
|
- if (rc == RPMERR_ITER_END)
|
|
- rc = 0;
|
|
- break;
|
|
- }
|
|
-
|
|
- action = rpmfsGetAction(fs, rpmfiFX(fi));
|
|
+ while (!rc && (fx = rpmfiNext(fi)) >= 0) {
|
|
+ action = rpmfsGetAction(fs, fx);
|
|
skip = XFA_SKIPPING(action);
|
|
if (action != FA_TOUCH) {
|
|
suffix = S_ISDIR(rpmfiFMode(fi)) ? NULL : tid;
|
|
@@ -896,7 +888,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
|
|
if (rc) {
|
|
skip = 1;
|
|
} else {
|
|
- setFileState(fs, rpmfiFX(fi));
|
|
+ setFileState(fs, fx);
|
|
}
|
|
|
|
if (!skip) {
|
|
@@ -1005,6 +997,9 @@ touch:
|
|
fpath = _free(fpath);
|
|
}
|
|
|
|
+ if (!rc && fx != RPMERR_ITER_END)
|
|
+ rc = fx;
|
|
+
|
|
rpmswAdd(rpmtsOp(ts, RPMTS_OP_UNCOMPRESS), fdOp(payload, FDSTAT_READ));
|
|
rpmswAdd(rpmtsOp(ts, RPMTS_OP_DIGEST), fdOp(payload, FDSTAT_DIGEST));
|
|
|
|
--
|
|
2.27.0
|
|
|