diff options
author | flz <flz@FreeBSD.org> | 2008-04-16 13:05:35 +0000 |
---|---|---|
committer | flz <flz@FreeBSD.org> | 2008-04-16 13:05:35 +0000 |
commit | 60968ceaffb2a0863f0fa776a74f9b0fe66aa169 (patch) | |
tree | 14b8c8031d1280d76b654585d93e081ab21e84b2 | |
parent | 2e4b86adc7ebc6a6f218f0ad58bf2e06954acd0d (diff) | |
download | FreeBSD-src-60968ceaffb2a0863f0fa776a74f9b0fe66aa169.zip FreeBSD-src-60968ceaffb2a0863f0fa776a74f9b0fe66aa169.tar.gz |
Fix pkg_info when specifying a remote package.
MFC after: 1 week
-rw-r--r-- | usr.sbin/pkg_install/info/main.c | 2 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/perform.c | 39 |
2 files changed, 23 insertions, 18 deletions
diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c index 74081bb..64c7995 100644 --- a/usr.sbin/pkg_install/info/main.c +++ b/usr.sbin/pkg_install/info/main.c @@ -236,7 +236,7 @@ main(int argc, char **argv) * Don't try to apply heuristics if arguments are regexs or if * the argument refers to an existing file. */ - if (MatchType != MATCH_REGEX && MatchType != MATCH_EREGEX && !isfile(*argv)) + if (MatchType != MATCH_REGEX && MatchType != MATCH_EREGEX && !isfile(*argv) && !isURL(*argv)) while ((pkgs_split = strrchr(*argv, (int)'/')) != NULL) { *pkgs_split++ = '\0'; /* diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c index 3f3ceb0..3803d64 100644 --- a/usr.sbin/pkg_install/info/perform.c +++ b/usr.sbin/pkg_install/info/perform.c @@ -101,8 +101,11 @@ pkg_do(char *pkg) if (isURL(pkg)) { if ((cp = fileGetURL(NULL, pkg, KeepPackage)) != NULL) { - strcpy(fname, cp); + if (!getcwd(fname, FILENAME_MAX)) + upchuck("getcwd"); isTMP = TRUE; + } else { + goto bail; } } else if (fexists(pkg) && isfile(pkg)) { @@ -123,22 +126,24 @@ pkg_do(char *pkg) strncpy(fname, cp, FILENAME_MAX); } if (cp) { - /* - * Apply a crude heuristic to see how much space the package will - * take up once it's unpacked. I've noticed that most packages - * compress an average of 75%, but we're only unpacking the + files so - * be very optimistic. - */ - if (stat(fname, &sb) == FAIL) { - warnx("can't stat package file '%s'", fname); - code = 1; - goto bail; - } - Home = make_playpen(PlayPen, sb.st_size / 2); - if (unpack(fname, "'+*'")) { - warnx("error during unpacking, no info for '%s' available", pkg); - code = 1; - goto bail; + if (!isURL(pkg)) { + /* + * Apply a crude heuristic to see how much space the package will + * take up once it's unpacked. I've noticed that most packages + * compress an average of 75%, but we're only unpacking the + files so + * be very optimistic. + */ + if (stat(fname, &sb) == FAIL) { + warnx("can't stat package file '%s'", fname); + code = 1; + goto bail; + } + Home = make_playpen(PlayPen, sb.st_size / 2); + if (unpack(fname, "'+*'")) { + warnx("error during unpacking, no info for '%s' available", pkg); + code = 1; + goto bail; + } } } /* It's not an uninstalled package, try and find it among the installed */ |