diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-04-08 06:06:42 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-04-08 06:06:42 +0000 |
commit | 79523261f7033c669a4667180dca6dfeef18be2c (patch) | |
tree | 942e0b8f0e69f5cb8351e390be49b01f761d8d2d /usr.sbin/pkg_install/lib | |
parent | 9c466edcbc02d58cb2b061fda22a373ba90b630b (diff) | |
download | FreeBSD-src-79523261f7033c669a4667180dca6dfeef18be2c.zip FreeBSD-src-79523261f7033c669a4667180dca6dfeef18be2c.tar.gz |
When invoking tar, make sure the mode option (-x) is first.
Diffstat (limited to 'usr.sbin/pkg_install/lib')
-rw-r--r-- | usr.sbin/pkg_install/lib/file.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index 5cb0d49..b29993c 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -328,9 +328,9 @@ copy_hierarchy(const char *dir, const char *fname, Boolean to) int unpack(const char *pkg, const char *flist) { - char args[10], suff[80], *cp; + char *comp, suff[80], *cp; - args[0] = '\0'; + comp = ""; /* * Figure out by a crude heuristic whether this or not this is probably * compressed and whichever compression utility was used (gzip or bzip2). @@ -341,17 +341,16 @@ unpack(const char *pkg, const char *flist) strcpy(suff, cp + 1); if (strchr(suff, 'z') || strchr(suff, 'Z')) { if (strchr(suff, 'b')) - strcpy(args, "-j"); + comp = "-j"; else - strcpy(args, "-z"); + comp = "-z"; } } } else /* XXX: need to handle .tgz also */ - strcpy(args, "-j"); - strcat(args, " -xpf"); - if (vsystem("tar %s '%s' %s", args, pkg, flist ? flist : "")) { + comp = "-j"; + if (vsystem("tar -xp %s -f '%s' %s", comp, pkg, flist ? flist : "")) { warnx("tar extract of %s failed!", pkg); return 1; } |