From 940fd156aef284cde69149f9ba8eddeff68902cf Mon Sep 17 00:00:00 2001 From: jkh Date: Thu, 6 Mar 1997 10:21:57 +0000 Subject: [PATCH] Protect against missing initial @cwd. Closes PR#2893 Submitted-By: pius@iago.ienet.com --- usr.sbin/pkg_install/delete/perform.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c index b19592c53247..4187a8c33dfa 100644 --- a/usr.sbin/pkg_install/delete/perform.c +++ b/usr.sbin/pkg_install/delete/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id$"; +static const char *rcsid = "$Id: perform.c,v 1.12 1997/02/22 16:09:37 peter Exp $"; #endif /* @@ -93,8 +93,12 @@ pkg_do(char *pkg) add_plist(&Plist, PLIST_CWD, Prefix); read_plist(&Plist, cfile); fclose(cfile); - setenv(PKG_PREFIX_VNAME, - (p = find_plist(&Plist, PLIST_CWD)) ? p->name : NULL, 1); + p = find_plist(&Plist, PLIST_CWD); + if (!p) { + whinge("Package '%s' doesn't have a prefix.", pkg); + return 1; + } + setenv(PKG_PREFIX_VNAME, p->name, 1); if (fexists(REQUIRE_FNAME)) { if (Verbose) printf("Executing 'require' script.\n");