The following commit has been merged in the master branch:
commit 469c5fa91e12fdded4e4c6f7131a965e889d5b18
Author: Guillem Jover <[email protected]>
Date:   Fri Feb 4 00:41:26 2011 +0100

    dpkg: Always call pkg_has_postrm_script() in removal_bulk()
    
    Instead of letting removal_bulk_remove_files() tell the caller it has
    found a postrm script in its branch and calling pkg_has_postrm_script()
    on the other, just unconditionally call it always.
    
    This removes the need to pass back the value via out_foundpostrm, which
    makes further refactoring slightly more convoluted.

diff --git a/src/remove.c b/src/remove.c
index cb70940..a9044e7 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -183,9 +183,8 @@ static void push_leftover(struct fileinlist **leftoverp,
   *leftoverp= newentry;
 }
 
-static void removal_bulk_remove_files(
-    struct pkginfo *pkg,
-    bool *out_foundpostrm)
+static void
+removal_bulk_remove_files(struct pkginfo *pkg)
 {
   int before;
   int infodirbaseused;
@@ -279,7 +278,6 @@ static void removal_bulk_remove_files(
     varbuf_add_char(&fnvb, '\0');
     dsd= opendir(fnvb.buf); if (!dsd) ohshite(_("cannot read info directory"));
     push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd);
-    *out_foundpostrm = false;
 
     debug(dbg_general, "removal_bulk cleaning info directory");
 
@@ -295,7 +293,6 @@ static void removal_bulk_remove_files(
       /* We need the postrm and list files for --purge. */
       if (!strcmp(p+1,LISTFILE)) continue;
       if (!strcmp(p + 1, POSTRMFILE)) {
-        *out_foundpostrm = true;
         continue;
       }
       debug(dbg_stupidlyverbose, "removal_bulk info not postrm or list");
@@ -537,18 +534,16 @@ pkg_has_postrm_script(struct pkginfo *pkg)
  * conflicting package.
  */
 void removal_bulk(struct pkginfo *pkg) {
-  bool foundpostrm = false;
+  bool foundpostrm;
 
   debug(dbg_general,"removal_bulk package %s",pkg->name);
 
   if (pkg->status == stat_halfinstalled || pkg->status == stat_unpacked) {
-
-    removal_bulk_remove_files(pkg, &foundpostrm);
-
-  } else {
-    foundpostrm = pkg_has_postrm_script(pkg);
+    removal_bulk_remove_files(pkg);
   }
 
+  foundpostrm = pkg_has_postrm_script(pkg);
+
   debug(dbg_general, "removal_bulk purging? foundpostrm=%d",foundpostrm);
 
   if (!foundpostrm && !pkg->installed.conffiles) {

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to