michal-grzedzicki / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
20850a
diff --git a/lib/rpmfs.c b/lib/rpmfs.c
20850a
index 764618d..916f6eb 100644
20850a
--- a/lib/rpmfs.c
20850a
+++ b/lib/rpmfs.c
20850a
@@ -18,7 +18,7 @@ rpmfs rpmfsNew(rpm_count_t fc, int initState)
20850a
     rpmfs fs = xcalloc(1, sizeof(*fs));
20850a
     fs->fc = fc;
20850a
     fs->actions = xmalloc(fs->fc * sizeof(*fs->actions));
20850a
-    memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions));
20850a
+    rpmfsResetActions(fs);
20850a
     if (initState) {
20850a
 	fs->states = xmalloc(sizeof(*fs->states) * fs->fc);
20850a
 	memset(fs->states, RPMFILE_STATE_NORMAL, fs->fc);
20850a
@@ -115,3 +115,10 @@ void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action)
20850a
 	fs->actions[ix] = action;
20850a
     }
20850a
 }
20850a
+
20850a
+void rpmfsResetActions(rpmfs fs)
20850a
+{
20850a
+    if (fs && fs->actions) {
20850a
+	memset(fs->actions, FA_UNKNOWN, fs->fc * sizeof(*fs->actions));
20850a
+    }
20850a
+}
20850a
diff --git a/lib/rpmfs.h b/lib/rpmfs.h
20850a
index 5f74753..83f99d1 100644
20850a
--- a/lib/rpmfs.h
20850a
+++ b/lib/rpmfs.h
20850a
@@ -57,6 +57,9 @@ rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix);
20850a
 RPM_GNUC_INTERNAL
20850a
 void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action);
20850a
 
20850a
+RPM_GNUC_INTERNAL
20850a
+void rpmfsResetActions(rpmfs fs);
20850a
+
20850a
 #ifdef __cplusplus
20850a
 }
20850a
 #endif
20850a
diff --git a/lib/transaction.c b/lib/transaction.c
20850a
index 02badc6..09c199a 100644
20850a
--- a/lib/transaction.c
20850a
+++ b/lib/transaction.c
20850a
@@ -1323,11 +1323,14 @@ static int rpmtsPrepare(rpmts ts)
20850a
 
20850a
     rpmlog(RPMLOG_DEBUG, "computing %" PRIu64 " file fingerprints\n", fileCount);
20850a
 
20850a
-    /* Skip netshared paths, not our i18n files, and excluded docs */
20850a
+    /* Reset actions, set skip for netshared paths and excluded files */
20850a
     pi = rpmtsiInit(ts);
20850a
     while ((p = rpmtsiNext(pi, 0)) != NULL) {
20850a
 	if (rpmfiFC(rpmteFI(p)) == 0)
20850a
 	    continue;
20850a
+	/* Ensure clean state, this could get called more than once. */
20850a
+	rpmfs fs = rpmteGetFileStates(p);
20850a
+	rpmfsResetActions(fs);
20850a
 	if (rpmteType(p) == TR_ADDED) {
20850a
 	    skipInstallFiles(ts, p);
20850a
 	} else {