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
This commit is contained in:
parent
512e98364a
commit
2d72f72583
@ -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 ul_oct(u_long, char *, int, int);
|
||||
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_name_string; /* ././@LongLink hackery name */
|
||||
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 @@ check_sum(char *hd, size_t hdlen, char *bl, size_t bllen)
|
||||
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 @@ tar_id(char *blk, int size)
|
||||
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 @@ ustar_id(char *blk, int size)
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user