summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install/files/lib/pkgdb.c
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2008-08-02 20:33:50 +0000
committerjoerg <joerg@pkgsrc.org>2008-08-02 20:33:50 +0000
commit2d14d746c33ed096821a94626a0607aa53d26fe9 (patch)
tree8901b5966bac844405a560018181d94cc4eccd35 /pkgtools/pkg_install/files/lib/pkgdb.c
parent3e4bed6c122de22806583e1d7904c4f0e9a71d46 (diff)
downloadpkgsrc-2d14d746c33ed096821a94626a0607aa53d26fe9.tar.gz
Most memory allocation failures were fatal already and the majority of
the rest lacked an explicit check. Add the usual x* wrappers around malloc and friends that explicitly terminate on error and use them in all but Dewey.
Diffstat (limited to 'pkgtools/pkg_install/files/lib/pkgdb.c')
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c
index dafff849a30..1e6caf11297 100644
--- a/pkgtools/pkg_install/files/lib/pkgdb.c
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pkgdb.c,v 1.29.4.1 2008/05/23 15:57:04 joerg Exp $ */
+/* $NetBSD: pkgdb.c,v 1.29.4.2 2008/08/02 20:33:50 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: pkgdb.c,v 1.29.4.1 2008/05/23 15:57:04 joerg Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.29.4.2 2008/08/02 20:33:50 joerg Exp $");
#endif
/*-
@@ -341,10 +341,5 @@ _pkgdb_setPKGDB_DIR(const char *dir)
char *
pkgdb_pkg_file(const char *pkg, const char *file)
{
- char *buf;
-
- if (asprintf(&buf, "%s/%s/%s", _pkgdb_getPKGDB_DIR(), pkg, file) == -1)
- err(EXIT_FAILURE, "asprintf failed");
-
- return buf;
+ return xasprintf("%s/%s/%s", _pkgdb_getPKGDB_DIR(), pkg, file);
}