Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/restore If we hit an unknown header type (likely to be ...
details: https://anonhg.NetBSD.org/src/rev/9fb3d7deaf3d
branches: trunk
changeset: 943444:9fb3d7deaf3d
user: bouyer <bouyer%NetBSD.org@localhost>
date: Thu Sep 03 19:31:34 2020 +0000
description:
If we hit an unknown header type (likely to be a corrupt record), and
the user choose to not abort, skip to the next header instead of trying
to use it.
This allowed me to recover files from a corrupt dump, instead of
getting a segfault.
diffstat:
sbin/restore/tape.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 63a6afab146f -r 9fb3d7deaf3d sbin/restore/tape.c
--- a/sbin/restore/tape.c Thu Sep 03 19:10:56 2020 +0000
+++ b/sbin/restore/tape.c Thu Sep 03 19:31:34 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tape.c,v 1.68 2015/03/02 03:17:24 enami Exp $ */
+/* $NetBSD: tape.c,v 1.69 2020/09/03 19:31:34 bouyer Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)tape.c 8.9 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: tape.c,v 1.68 2015/03/02 03:17:24 enami Exp $");
+__RCSID("$NetBSD: tape.c,v 1.69 2020/09/03 19:31:34 bouyer Exp $");
#endif
#endif /* not lint */
@@ -1384,6 +1384,7 @@
top:
do {
if (header->c_magic != FS_UFS2_MAGIC) {
+skip:
skipcnt++;
while (gethead(header) == FAIL ||
header->c_date != dumpdate)
@@ -1438,7 +1439,8 @@
default:
panic("unknown tape header type %d\n", spcl.c_type);
- break;
+ fprintf(stderr, "skiping to next header\n");
+ goto skip;
}
} while (header->c_type == TS_ADDR);
Home |
Main Index |
Thread Index |
Old Index