diff options
Diffstat (limited to 'usr.sbin/pkg_install/info/perform.c')
-rw-r--r-- | usr.sbin/pkg_install/info/perform.c | 39 |
1 files changed, 22 insertions, 17 deletions
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 */ |