If the plist doesn't have a @name tag in it, fake one up based on the

directory name.
This commit is contained in:
joerg 2009-04-23 22:13:00 +00:00
parent 2b4f3d904f
commit 805721649e

View file

@ -34,7 +34,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
__RCSID("$NetBSD: pkg_delete.c,v 1.4 2009/03/30 19:26:39 joerg Exp $");
__RCSID("$NetBSD: pkg_delete.c,v 1.5 2009/04/23 22:13:00 joerg Exp $");
#if HAVE_ERR_H
#include <err.h>
@ -671,6 +671,12 @@ remove_pkg(const char *pkg)
return 1;
}
if (find_plist(&plist, PLIST_NAME) == NULL) {
/* Cheat a bit to allow removal of such bad packages. */
warnx("Package `%s' doesn't have a name", pkg);
add_plist_top(&plist, PLIST_NAME, pkg);
}
setenv(PKG_PREFIX_VNAME, p->name, 1);
fname = xasprintf("%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
setenv(PKG_METADATA_DIR_VNAME, fname, 1);