summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install/create
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2002-10-17 03:31:33 +0000
committerchristos <christos@NetBSD.org>2002-10-17 03:31:33 +0000
commit590fa669c8d8dee326e9540fdae461ef4c9d6f59 (patch)
treefc5354671378d5829a709c25be360e28577e936a /usr.sbin/pkg_install/create
parentfe9dc5bbfc2256202a8a237372215c5b9008bebe (diff)
- eliminate the hard-coding of pathnames in the default install.
- all command executions now use the path [execvp/execlp/system]. - normalize the macro names as <COMMAND>_CMD. - in some OS's full pathnames for commands can still be provided, but this is not the default. This was needed to fix -DTAR_FULLPATHNAME="/usr/bin/tar"
Diffstat (limited to 'usr.sbin/pkg_install/create')
-rw-r--r--usr.sbin/pkg_install/create/perform.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index b18dfc077d8..d534bde938c 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -1,11 +1,11 @@
-/* $NetBSD: perform.c,v 1.33 2002/07/19 19:04:36 yamt Exp $ */
+/* $NetBSD: perform.c,v 1.34 2002/10/17 03:31:34 christos Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.38 1997/10/13 15:03:51 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.33 2002/07/19 19:04:36 yamt Exp $");
+__RCSID("$NetBSD: perform.c,v 1.34 2002/10/17 03:31:34 christos Exp $");
#endif
#endif
@@ -46,12 +46,15 @@ make_dist(const char *home, const char *pkg, const char *suffix, const package_t
const plist_t *p;
int ret;
char *args[50]; /* Much more than enough. */
- int nargs = 0;
+ int nargs = 1;
int pipefds[2];
FILE *totar;
pid_t pid;
- args[nargs++] = TAR_CMD;/* argv[0] */
+ if ((args[0] = strrchr(TAR_CMD, '/')) == NULL)
+ args[0] = TAR_CMD;
+ else
+ args[0]++;
if (*pkg == '/')
(void) snprintf(tball, sizeof(tball), "%s.%s", pkg, suffix);
@@ -86,13 +89,13 @@ make_dist(const char *home, const char *pkg, const char *suffix, const package_t
}
if ((pid = fork()) == -1) {
cleanup(0);
- errx(2, "cannot fork process for %s", TAR_FULLPATHNAME);
+ errx(2, "cannot fork process for %s", TAR_CMD);
}
if (pid == 0) { /* The child */
dup2(pipefds[0], 0);
close(pipefds[0]);
close(pipefds[1]);
- execv(TAR_FULLPATHNAME, args);
+ execvp(TAR_CMD, args);
cleanup(0);
errx(2, "failed to execute %s command", TAR_CMD);
}