The following commit has been merged in the master branch:
commit 869564af64bb745501ee4a22e2609b18ad60d34b
Author: Guillem Jover <[email protected]>
Date:   Sat Feb 19 05:13:59 2011 +0100

    dpkg: Use pkgadminfile() instead of varbuf_pkgadminfile()
    
    This simplifies the API, and unifies the different call sites, the
    extremely small performance penalty is irrelevant in these cases.

diff --git a/src/filesdb.c b/src/filesdb.c
index cd34a2a..7382f72 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -461,13 +461,14 @@ void
 write_filelist_except(struct pkginfo *pkg, struct fileinlist *list,
                       bool leaveout)
 {
-  static struct varbuf vb, newvb;
+  static struct varbuf newvb;
+  const char *listfile;
   FILE *file;
 
-  varbuf_pkgadminfile(&vb, pkg, LISTFILE);
+  listfile = pkgadminfile(pkg, LISTFILE);
 
   varbuf_reset(&newvb);
-  varbuf_add_str(&newvb, vb.buf);
+  varbuf_add_str(&newvb, listfile);
   varbuf_add_str(&newvb, NEWDBEXT);
   varbuf_add_char(&newvb, '\0');
 
@@ -491,7 +492,7 @@ write_filelist_except(struct pkginfo *pkg, struct 
fileinlist *list,
   pop_cleanup(ehflag_normaltidy); /* file = fopen() */
   if (fclose(file))
     ohshite(_("failed to close updated files list file for package 
%s"),pkg->name);
-  if (rename(newvb.buf,vb.buf))
+  if (rename(newvb.buf, listfile))
     ohshite(_("failed to install updated files list file for package 
%s"),pkg->name);
 
   dir_sync_path(pkgadmindir());
diff --git a/src/remove.c b/src/remove.c
index e79eba8..d618c5f 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -561,18 +561,22 @@ void removal_bulk(struct pkginfo *pkg) {
 
   /* I.e., either of the two branches above. */
   if (pkg->want == want_purge) {
-    static struct varbuf fnvb;
+    const char *filename;
 
     /* Retry empty directories, and warn on any leftovers that aren't. */
     removal_bulk_remove_leftover_dirs(pkg);
 
-    varbuf_pkgadminfile(&fnvb, pkg, LISTFILE);
-    debug(dbg_general, "removal_bulk purge done, removing list `%s'",fnvb.buf);
-    if (unlink(fnvb.buf) && errno != ENOENT) ohshite(_("cannot remove old 
files list"));
-
-    varbuf_pkgadminfile(&fnvb, pkg, POSTRMFILE);
-    debug(dbg_general, "removal_bulk purge done, removing postrm 
`%s'",fnvb.buf);
-    if (unlink(fnvb.buf) && errno != ENOENT) ohshite(_("can't remove old 
postrm script"));
+    filename = pkgadminfile(pkg, LISTFILE);
+    debug(dbg_general, "removal_bulk purge done, removing list `%s'",
+          filename);
+    if (unlink(filename) && errno != ENOENT)
+      ohshite(_("cannot remove old files list"));
+
+    filename = pkgadminfile(pkg, POSTRMFILE);
+    debug(dbg_general, "removal_bulk purge done, removing postrm `%s'",
+          filename);
+    if (unlink(filename) && errno != ENOENT)
+      ohshite(_("can't remove old postrm script"));
 
     pkg->status= stat_notinstalled;
     pkg->want = want_unknown;

-- 
dpkg's main repository


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

Reply via email to