Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/usr.sbin/pkg_install/create Pull up revision 1.34 (requ...



details:   https://anonhg.NetBSD.org/src/rev/668631809cf1
branches:  netbsd-1-6
changeset: 529522:668631809cf1
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Nov 24 22:33:56 2002 +0000

description:
Pull up revision 1.34 (requested by jschauma in ticket #1011):
- 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:

 usr.sbin/pkg_install/create/perform.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r 9695a4f905c1 -r 668631809cf1 usr.sbin/pkg_install/create/perform.c
--- a/usr.sbin/pkg_install/create/perform.c     Sun Nov 24 22:33:47 2002 +0000
+++ b/usr.sbin/pkg_install/create/perform.c     Sun Nov 24 22:33:56 2002 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.30.2.2 2002/07/21 04:41:39 lukem Exp $   */
+/*     $NetBSD: perform.c,v 1.30.2.3 2002/11/24 22:33:56 tron 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.30.2.2 2002/07/21 04:41:39 lukem Exp $");
+__RCSID("$NetBSD: perform.c,v 1.30.2.3 2002/11/24 22:33:56 tron Exp $");
 #endif
 #endif
 
@@ -46,12 +46,15 @@
        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 @@
        }
        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);
        }



Home | Main Index | Thread Index | Old Index