RP/8227: Peter Seeback: Emulate old gnu tar better.

This commit is contained in:
christos 2003-03-31 20:06:33 +00:00
parent acddf8ff0b
commit 2cdcd6cab2
3 changed files with 21 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ar_io.c,v 1.33 2003/02/25 13:36:59 wiz Exp $ */
/* $NetBSD: ar_io.c,v 1.34 2003/03/31 20:06:33 christos Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
__RCSID("$NetBSD: ar_io.c,v 1.33 2003/02/25 13:36:59 wiz Exp $");
__RCSID("$NetBSD: ar_io.c,v 1.34 2003/03/31 20:06:33 christos Exp $");
#endif
#endif /* not lint */
@ -787,7 +787,7 @@ ar_read(char *buf, int cnt)
lstrval = res;
if (res < 0)
syswarn(1, errno, "Failed read on archive volume %d", arvol);
else if (!is_gnutar)
else
tty_warn(0, "End of archive volume %d reached", arvol);
return(res);
}
@ -1407,7 +1407,7 @@ ar_next(void)
if (sigprocmask(SIG_SETMASK, &o_mask, (sigset_t *)NULL) < 0)
syswarn(0, errno, "Unable to restore signal mask");
if (done || !wr_trail || is_gnutar || force_one_volume)
if (done || !wr_trail || force_one_volume)
return(-1);
tty_prnt("\nATTENTION! %s archive volume change required.\n", argv0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ar_subs.c,v 1.23 2003/02/09 18:27:10 grant Exp $ */
/* $NetBSD: ar_subs.c,v 1.24 2003/03/31 20:06:33 christos Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94";
#else
__RCSID("$NetBSD: ar_subs.c,v 1.23 2003/02/09 18:27:10 grant Exp $");
__RCSID("$NetBSD: ar_subs.c,v 1.24 2003/03/31 20:06:33 christos Exp $");
#endif
#endif /* not lint */
@ -1042,9 +1042,8 @@ next_head(ARCHD *arcn)
* storage device, better give the user the bad news.
*/
if ((ret == 0) || (rd_sync() < 0)) {
if (!is_gnutar)
tty_warn(1,
"Premature end of file on archive read");
tty_warn(1,
"Premature end of file on archive read");
return(-1);
}
if (!in_resync) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: tar.c,v 1.36 2003/01/09 18:24:08 christos Exp $ */
/* $NetBSD: tar.c,v 1.37 2003/03/31 20:06:33 christos 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.36 2003/01/09 18:24:08 christos Exp $");
__RCSID("$NetBSD: tar.c,v 1.37 2003/03/31 20:06:33 christos Exp $");
#endif
#endif /* not lint */
@ -175,8 +175,17 @@ tar_trail(char *buf, int in_resync, int *cnt)
* might as well throw this block out since a valid header can NEVER be
* a block of all 0 (we must have a valid file name).
*/
if (!in_resync && (++*cnt >= NULLCNT))
return(0);
if (!in_resync) {
++*cnt;
/*
* old GNU tar (up through 1.13) only writes one block of
* trailers, so we pretend we got another
*/
if (is_gnutar)
++*cnt;
if (*cnt >= NULLCNT)
return(0);
}
return(1);
}