Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/gzip Count the output file size modulo 2^32 so that ...



details:   https://anonhg.NetBSD.org/src/rev/b1c087526628
branches:  trunk
changeset: 569880:b1c087526628
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sat Sep 11 11:07:44 2004 +0000

description:
Count the output file size modulo 2^32 so that the check against the size
in the compressed file works for files greater than 4GB.
Fixes the fixable part of bin/26907

diffstat:

 usr.bin/gzip/gzip.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r e63bf6d752fd -r b1c087526628 usr.bin/gzip/gzip.c
--- a/usr.bin/gzip/gzip.c       Sat Sep 11 08:33:53 2004 +0000
+++ b/usr.bin/gzip/gzip.c       Sat Sep 11 11:07:44 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gzip.c,v 1.66 2004/09/05 21:32:30 dsl Exp $    */
+/*     $NetBSD: gzip.c,v 1.67 2004/09/11 11:07:44 dsl Exp $    */
 
 /*
  * Copyright (c) 1997, 1998, 2003, 2004 Matthew R. Green
@@ -32,7 +32,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004 Matthew R. Green\n\
      All rights reserved.\n");
-__RCSID("$NetBSD: gzip.c,v 1.66 2004/09/05 21:32:30 dsl Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.67 2004/09/11 11:07:44 dsl Exp $");
 #endif /* not lint */
 
 /*
@@ -655,7 +655,8 @@
 {
        z_stream z;
        char *outbufp, *inbufp;
-       off_t out_tot, out_sub_tot, in_tot;
+       off_t out_tot, in_tot;
+       uint32_t out_sub_tot;
        enum {
                GZSTATE_MAGIC0,
                GZSTATE_MAGIC1,
@@ -1415,6 +1416,7 @@
        if (tflag)
                return size;
 #endif
+       /* if we are uncompressing to stdin, don't remove the file. */
        if (cflag)
                return size;
 
@@ -1422,8 +1424,7 @@
         * if we create a file...
         */
        /*
-        * if we can't stat the file, or we are uncompressing to
-        * stdin, don't remove the file.
+        * if we can't stat the file don't remove the file.
         */
        if (stat(outfile, &osb) < 0) {
                maybe_warn("couldn't stat (leaving original): %s",



Home | Main Index | Thread Index | Old Index