diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c index 74081bb4efab..64c799515647 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 3f3ceb0d5094..3803d64d2f77 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 */