need to chroot() a bit sooner
authorewt <devnull@localhost>
Sun, 7 Feb 1999 20:09:27 +0000 (20:09 +0000)
committerewt <devnull@localhost>
Sun, 7 Feb 1999 20:09:27 +0000 (20:09 +0000)
CVS patchset: 2781
CVS date: 1999/02/07 20:09:27

lib/transaction.c

index 705ce97..14ce899 100644 (file)
@@ -197,13 +197,6 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
         fi->fps = alloca(fi->fc * sizeof(*fi->fps));
     }
 
-    for (fi = flList; (fi - flList) < flEntries; fi++) {
-       fpLookupList(fi->fl, fi->fps, fi->fc, 1);
-       for (i = 0; i < fi->fc; i++) {
-           htAddEntry(ht, fi->fps + i, fi);
-       }
-    }
-
     chptr = currentDirectory();
     currDir = alloca(strlen(chptr) + 1);
     strcpy(currDir, chptr);
@@ -212,6 +205,13 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
     chroot(ts->root);
 
     for (fi = flList; (fi - flList) < flEntries; fi++) {
+       fpLookupList(fi->fl, fi->fps, fi->fc, 1);
+       for (i = 0; i < fi->fc; i++) {
+           htAddEntry(ht, fi->fps + i, fi);
+       }
+    }
+
+    for (fi = flList; (fi - flList) < flEntries; fi++) {
        matches = malloc(sizeof(*matches) * fi->fc);
        if (rpmdbFindFpList(ts->db, fi->fps, matches, fi->fc)) return 1;
 
@@ -321,7 +321,8 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
            if (installBinaryPackage(ts->root, ts->db, fd, 
                                     hdrs[alp - al->list], instFlags, notify, 
                                     notifyData, alp->key, fi->actions, 
-                                    fi->fc ? fi->replaced : NULL))
+                                    fi->fc ? fi->replaced : NULL,
+                                    ts->scriptFd))
                ourrc++;
        } else {
            ourrc++;
@@ -340,7 +341,7 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
     /* fi is left at the first package which is to be removed */
     for (i = 0; i < ts->numRemovedPackages; i++, fi++) {
        if (removeBinaryPackage(ts->root, ts->db, ts->removedPackages[i], 
-                               rmFlags, fi->actions))
+                               rmFlags, fi->actions, ts->scriptFd))
            ourrc++;
     }
 
@@ -350,6 +351,10 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
        return 0;
 }
 
+void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd) {
+    ts->scriptFd = fd;
+}
+
 static rpmProblemSet psCreate(void) {
     rpmProblemSet probs;