[Midnightbsd-cvs] src: pkg_install/info: Fix pkg_info when specifying a remote package.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Sep 12 13:13:35 EDT 2008
Log Message:
-----------
Fix pkg_info when specifying a remote package.
Modified Files:
--------------
src/usr.sbin/pkg_install/info:
main.c (r1.3 -> r1.4)
perform.c (r1.1.1.2 -> r1.2)
-------------- next part --------------
Index: perform.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/pkg_install/info/perform.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L usr.sbin/pkg_install/info/perform.c -L usr.sbin/pkg_install/info/perform.c -u -r1.1.1.2 -r1.2
--- usr.sbin/pkg_install/info/perform.c
+++ usr.sbin/pkg_install/info/perform.c
@@ -101,8 +101,11 @@
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 @@
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 */
Index: main.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/pkg_install/info/main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -L usr.sbin/pkg_install/info/main.c -L usr.sbin/pkg_install/info/main.c -u -r1.3 -r1.4
--- usr.sbin/pkg_install/info/main.c
+++ usr.sbin/pkg_install/info/main.c
@@ -236,7 +236,7 @@
* 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';
/*
More information about the Midnightbsd-cvs
mailing list