Source-Changes-HG archive

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

[src/trunk]: src/bin/pax Don't emit any warnings when tar is trying to figure...



details:   https://anonhg.NetBSD.org/src/rev/395a7ea24cf2
branches:  trunk
changeset: 555680:395a7ea24cf2
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Nov 24 23:48:47 2003 +0000

description:
Don't emit any warnings when tar is trying to figure out if the file is
really tar format.  valid CPIO files should not trigger a warning from tar.c

diffstat:

 bin/pax/tar.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (66 lines):

diff -r 4d3f83988ea5 -r 395a7ea24cf2 bin/pax/tar.c
--- a/bin/pax/tar.c     Mon Nov 24 23:29:54 2003 +0000
+++ b/bin/pax/tar.c     Mon Nov 24 23:48:47 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tar.c,v 1.45 2003/10/27 00:12:41 lukem Exp $   */
+/*     $NetBSD: tar.c,v 1.46 2003/11/24 23:48:47 matt Exp $    */
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)tar.c      8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: tar.c,v 1.45 2003/10/27 00:12:41 lukem Exp $");
+__RCSID("$NetBSD: tar.c,v 1.46 2003/11/24 23:48:47 matt Exp $");
 #endif
 #endif /* not lint */
 
@@ -77,7 +77,7 @@
 static int ull_oct(unsigned long long, char *, int, int);
 #endif
 static int tar_gnutar_exclude_one(const char *, size_t);
-static int check_sum(char *, size_t, char *, size_t);
+static int check_sum(char *, size_t, char *, size_t, int);
 
 /*
  * Routines common to all versions of tar
@@ -95,7 +95,7 @@
 char *gnu_link_string;                 /* ././@LongLink hackery link */
 
 static int
-check_sum(char *hd, size_t hdlen, char *bl, size_t bllen)
+check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet)
 {
        u_long hdck, blck;
 
@@ -103,8 +103,9 @@
        blck = tar_chksm(bl, bllen);
 
        if (hdck != blck) {
-               tty_warn(0, "Header checksum %lo does not match %lo",
-                   hdck, blck);
+               if (!quiet)
+                       tty_warn(0, "Header checksum %lo does not match %lo",
+                           hdck, blck);
                return(-1);
        }
        return(0);
@@ -372,7 +373,7 @@
                return(-1);
        if (strncmp(uhd->magic, TMAGIC, TMAGLEN - 1) == 0)
                return(-1);
-       return check_sum(hd->chksum, sizeof(hd->chksum), blk, BLKMULT);
+       return check_sum(hd->chksum, sizeof(hd->chksum), blk, BLKMULT, 1);
 }
 
 /*
@@ -762,7 +763,7 @@
                tty_warn(0,
                    "Trying to read GNU tar archive with extensions off");
        }
-       return check_sum(hd->chksum, sizeof(hd->chksum), blk, BLKMULT);
+       return check_sum(hd->chksum, sizeof(hd->chksum), blk, BLKMULT, 0);
 }
 
 /*



Home | Main Index | Thread Index | Old Index