Add sanity check if there's a @cwd in the +CONTENT file.

If not abort, because we wouldn't know where to put the files.

Coverity CID 1358
This commit is contained in:
hubertf 2006-03-17 02:37:31 +00:00
parent 9ccbde6fee
commit 986192d148

View File

@ -1,4 +1,4 @@
/* $NetBSD: perform.c,v 1.116 2006/01/25 00:17:34 joerg Exp $ */
/* $NetBSD: perform.c,v 1.117 2006/03/17 02:37:31 hubertf Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@ -14,7 +14,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
__RCSID("$NetBSD: perform.c,v 1.116 2006/01/25 00:17:34 joerg Exp $");
__RCSID("$NetBSD: perform.c,v 1.117 2006/03/17 02:37:31 hubertf Exp $");
#endif
#endif
@ -500,6 +500,10 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs)
*/
if (is_depoted_pkg) {
p = find_plist(&Plist, PLIST_CWD);
if (p == NULL) {
warn("no @cwd in +CONTENTS file?! aborting.");
goto bomb;
}
(void) strlcpy(dbdir, dirname_of(p->name), sizeof(dbdir));
(void) strlcpy(LogDir, p->name, sizeof(LogDir));
} else {