Panu Matilainen 75a190
commit 2f20f6e6b2cc6f26794678d1db16659c484a001c
Panu Matilainen 75a190
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 75a190
Date:   Wed Mar 21 09:07:21 2012 +0200
Panu Matilainen 75a190
Panu Matilainen 75a190
    Transaction element file info can be legally NULL in some cases
Panu Matilainen 75a190
    
Panu Matilainen 75a190
    - rpmteClose() will wipe out the file info to free memory, we only
Panu Matilainen 75a190
      should care whether we failed to (re)load the file info. This
Panu Matilainen 75a190
      thinko in commit 06a2f1269b035a3a76464149834f2a5a8c4e89f2
Panu Matilainen 75a190
      broke %posttrans scriptlets (and without commit
Panu Matilainen 75a190
      274dbf557d1cac90f7c278f9b6d6af05997d92df, %pretrans in other
Panu Matilainen 75a190
      circumstances), whoopsie *blush*. Now, off to write a test-case
Panu Matilainen 75a190
      for our scriptlet behavior...
Panu Matilainen 75a190
Panu Matilainen 75a190
diff --git a/lib/rpmte.c b/lib/rpmte.c
Panu Matilainen 75a190
index 65e1e76..65d65af 100644
Panu Matilainen 75a190
--- a/lib/rpmte.c
Panu Matilainen 75a190
+++ b/lib/rpmte.c
Panu Matilainen 75a190
@@ -693,11 +693,12 @@ static int rpmteOpen(rpmte te, int reload_fi)
Panu Matilainen 75a190
     }
Panu Matilainen 75a190
     if (h != NULL) {
Panu Matilainen 75a190
 	if (reload_fi) {
Panu Matilainen 75a190
+	    /* This can fail if we get a different, bad header from callback */
Panu Matilainen 75a190
 	    te->fi = getFI(te, h);
Panu Matilainen 75a190
+	    rc = (te->fi != NULL);
Panu Matilainen 75a190
+	} else {
Panu Matilainen 75a190
+	    rc = 1;
Panu Matilainen 75a190
 	}
Panu Matilainen 75a190
-
Panu Matilainen 75a190
-	/* This can fail if we get a different, bad header from callback */
Panu Matilainen 75a190
-	rc = (te->fi != NULL);
Panu Matilainen 75a190
 	
Panu Matilainen 75a190
 	rpmteSetHeader(te, h);
Panu Matilainen 75a190
 	headerFree(h);