The following commit has been merged in the master branch:
commit 2fe2563ee3f2f63b05b6e76c658ea989bc4925fd
Author: Guillem Jover <[email protected]>
Date: Thu Feb 3 17:37:31 2011 +0100
dpkg: Use varbuf_pkgadminfile() instead of manually building the path
diff --git a/src/filesdb.c b/src/filesdb.c
index 3c68f71..cd34a2a 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -464,11 +464,7 @@ write_filelist_except(struct pkginfo *pkg, struct
fileinlist *list,
static struct varbuf vb, newvb;
FILE *file;
- varbuf_reset(&vb);
- varbuf_add_str(&vb, pkgadmindir());
- varbuf_add_str(&vb, pkg->name);
- varbuf_add_str(&vb, "." LISTFILE);
- varbuf_add_char(&vb, '\0');
+ varbuf_pkgadminfile(&vb, pkg, LISTFILE);
varbuf_reset(&newvb);
varbuf_add_str(&newvb, vb.buf);
diff --git a/src/remove.c b/src/remove.c
index b002fc3..cdf16e2 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -522,7 +522,6 @@ static void removal_bulk_remove_configfiles(struct pkginfo
*pkg) {
* conflicting package.
*/
void removal_bulk(struct pkginfo *pkg) {
- int pkgnameused;
bool foundpostrm = false;
const char *postrmfilename;
@@ -566,19 +565,11 @@ void removal_bulk(struct pkginfo *pkg) {
/* Retry empty directories, and warn on any leftovers that aren't. */
removal_bulk_remove_leftover_dirs(pkg);
- varbuf_reset(&fnvb);
- varbuf_add_str(&fnvb, pkgadmindir());
- varbuf_add_str(&fnvb, pkg->name);
- pkgnameused= fnvb.used;
-
- varbuf_add_str(&fnvb, "." LISTFILE);
- varbuf_add_char(&fnvb, '\0');
+ 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_trunc(&fnvb, pkgnameused);
- varbuf_add_str(&fnvb, "." POSTRMFILE);
- varbuf_add_char(&fnvb, '\0');
+ 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"));
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]