diff options
Diffstat (limited to 'pkgtools/pkg_install/files/lib/fexec.c')
-rw-r--r-- | pkgtools/pkg_install/files/lib/fexec.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/pkgtools/pkg_install/files/lib/fexec.c b/pkgtools/pkg_install/files/lib/fexec.c index c8c5185f9fc..b3b6a9da11f 100644 --- a/pkgtools/pkg_install/files/lib/fexec.c +++ b/pkgtools/pkg_install/files/lib/fexec.c @@ -58,7 +58,7 @@ #include "lib.h" #ifndef lint -__RCSID("$NetBSD: fexec.c,v 1.9.8.1 2008/05/23 15:57:04 joerg Exp $"); +__RCSID("$NetBSD: fexec.c,v 1.9.8.2 2008/08/02 20:33:50 joerg Exp $"); #endif static int vfcexec(const char *, int, const char *, va_list); @@ -106,8 +106,7 @@ vfcexec(const char *path, int skipempty, const char *arg, va_list ap) int retval; argv_size = 16; - if ((argv = malloc(argv_size * sizeof(*argv))) == NULL) - err(EXIT_FAILURE, "vfcexec: malloc failed"); + argv = xcalloc(argv_size, sizeof(*argv)); argv[0] = arg; argc = 1; @@ -115,9 +114,7 @@ vfcexec(const char *path, int skipempty, const char *arg, va_list ap) do { if (argc == argv_size) { argv_size *= 2; - argv = realloc(argv, argv_size * sizeof(*argv)); - if (argv == NULL) - err(EXIT_FAILURE, "vfcexec: realloc failed"); + argv = xrealloc(argv, argv_size * sizeof(*argv)); } arg = va_arg(ap, const char *); if (skipempty && arg && strlen(arg) == 0) |