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/lib Pull up revision 1.43 (request...



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

description:
Pull up revision 1.43 (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/lib/ftpio.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r e1dfa70d2acf -r 9695a4f905c1 usr.sbin/pkg_install/lib/ftpio.c
--- a/usr.sbin/pkg_install/lib/ftpio.c  Sun Nov 24 22:32:38 2002 +0000
+++ b/usr.sbin/pkg_install/lib/ftpio.c  Sun Nov 24 22:33:47 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: ftpio.c,v 1.35.2.5 2002/11/24 22:29:58 tron Exp $      */
+/*     $NetBSD: ftpio.c,v 1.35.2.6 2002/11/24 22:33:47 tron Exp $      */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.35.2.5 2002/11/24 22:29:58 tron Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.35.2.6 2002/11/24 22:33:47 tron Exp $");
 #endif
 
 /*
@@ -255,6 +255,11 @@
     int answer_pipe[2];
     int rc1, rc2;
     char buf[20];
+    char *argv0 = strrchr(FTP_CMD, '/');
+    if (argv0 == NULL)
+       argv0 = FTP_CMD;
+    else
+       argv0++;
 
     rc1 = pipe(command_pipe);
     rc2 = pipe(answer_pipe);
@@ -300,8 +305,8 @@
            
            if (Verbose)
                    fprintf(stderr, "ftp -detv %s\n", base);
-           rc1 = execl(FTP_FULLPATHNAME, FTP_CMD, "-detv", base, NULL);
-           warn("setupCoproc: execl() failed");
+           rc1 = execlp(FTP_CMD, argv0, "-detv", base, NULL);
+           warn("setupCoproc: execlp() failed");
            exit(1);
            break;
     default: 
@@ -689,7 +694,7 @@
                        printf("unpackURL '%s' to '%s'\n", url, dir);
 
                /* yes, this is gross, but needed for borken ftp(1) */
-               (void) snprintf(cmd, sizeof(cmd), "get %s \"| ( cd %s ; gunzip 2>/dev/null | " TAR_FULLPATHNAME " -%sx -f - | tee /dev/stderr )\"\n", pkg, dir, Verbose?"vv":"");
+               (void) snprintf(cmd, sizeof(cmd), "get %s \"| ( cd %s ; gunzip 2>/dev/null | " TAR_CMD " -%sx -f - | tee /dev/stderr )\"\n", pkg, dir, Verbose?"vv":"");
                rc = ftp_cmd(cmd, "\n(226|550).*\n");
                if (rc != 226) {
                        warnx("Cannot fetch file (%d!=226)!", rc);



Home | Main Index | Thread Index | Old Index