Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/usr.sbin/pkg_install/add Pull up revisions 1.108 - 1.109 ...



details:   https://anonhg.NetBSD.org/src/rev/4073d9d72b0d
branches:  netbsd-3
changeset: 576205:4073d9d72b0d
user:      riz <riz%NetBSD.org@localhost>
date:      Tue Jun 14 14:54:28 2005 +0000

description:
Pull up revisions 1.108 - 1.109 (requested by dm in ticket #444):
1.108:
Fix a minor bug in the estimation of required disk space.  In particular
make sure we use a data type which is big enough.  This fixes a problem
where pkg_add-ing of a binary package which is between 512 Mb and 1 Gb
failes because the estimated required disk space is negative due to over
flowing in the calculation

1.109:
Fix bad format string which broke the build on LP64 platforms.

diffstat:

 usr.sbin/pkg_install/add/perform.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r 7b0a3a81e5ce -r 4073d9d72b0d usr.sbin/pkg_install/add/perform.c
--- a/usr.sbin/pkg_install/add/perform.c        Mon Jun 13 22:12:27 2005 +0000
+++ b/usr.sbin/pkg_install/add/perform.c        Tue Jun 14 14:54:28 2005 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.107 2005/03/06 23:40:41 agc Exp $        */
+/*     $NetBSD: perform.c,v 1.107.2.1 2005/06/14 14:54:28 riz Exp $    */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.107 2005/03/06 23:40:41 agc Exp $");
+__RCSID("$NetBSD: perform.c,v 1.107.2.1 2005/06/14 14:54:28 riz Exp $");
 #endif
 #endif
 
@@ -35,6 +35,7 @@
 #include "add.h"
 #include "verify.h"
 
+#include <inttypes.h>
 #include <signal.h>
 #include <string.h>
 #include <stdlib.h>
@@ -182,6 +183,7 @@
        struct utsname host_uname;
        int     inPlace;
        int     rc;
+       uint64_t needed;
        Boolean is_depoted_pkg = FALSE;
 
        errc = 0;
@@ -302,11 +304,12 @@
                         * compress an average of 75%, so multiply by 4 for good measure.
                         */
 
-                       if (!inPlace && min_free(playpen) < sb.st_size * 4) {
-                               warnx("projected size of %ld bytes exceeds available free space\n"
+                       needed = 4 * (uint64_t) sb.st_size;
+                       if (!inPlace && min_free(playpen) < needed) {
+                               warnx("projected size of %" PRIu64 " bytes exceeds available free space\n"
                                    "in %s. Please set your PKG_TMPDIR variable to point\n"
                                    "to a location with more free space and try again.",
-                                       (long) (sb.st_size * 4), playpen);
+                                       needed, playpen);
                                goto bomb;
                        }
 



Home | Main Index | Thread Index | Old Index