summaryrefslogtreecommitdiff
path: root/usr.sbin/sysinst/util.c
diff options
context:
space:
mode:
authormartin <martin@NetBSD.org>2020-01-26 14:37:29 +0000
committermartin <martin@NetBSD.org>2020-01-26 14:37:29 +0000
commit92d23d4ebe4ffa0ac582629fd7ae52cfcc107ff9 (patch)
treea7ed02c4857410f4c0e4f660108afe23c60803b5 /usr.sbin/sysinst/util.c
parentdc769b46cee214810d72fa7af4411cfe4f1a9b71 (diff)
When retrying sets during extraction, reset the relevant statistics
to avoid counting retried sets multiple times. Reported by kim.
Diffstat (limited to 'usr.sbin/sysinst/util.c')
-rw-r--r--usr.sbin/sysinst/util.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/sysinst/util.c b/usr.sbin/sysinst/util.c
index 7bbeb725b72..f0f2a16e36c 100644
--- a/usr.sbin/sysinst/util.c
+++ b/usr.sbin/sysinst/util.c
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.41 2020/01/20 21:26:35 martin Exp $ */
+/* $NetBSD: util.c,v 1.42 2020/01/26 14:37:29 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -1085,7 +1085,7 @@ get_and_unpack_sets(int update, msg setupdone_msg, msg success_msg, msg failure_
{
distinfo *dist;
int status;
- int set;
+ int set, olderror, oldfound;
/* Ensure mountpoint for distribution files exists in current root. */
(void)mkdir("/mnt2", S_IRWXU| S_IRGRP|S_IXGRP | S_IROTH|S_IXOTH);
@@ -1115,6 +1115,10 @@ get_and_unpack_sets(int update, msg setupdone_msg, msg success_msg, msg failure_
if (set_status[set] != (SET_VALID | SET_SELECTED))
continue;
+ /* save stats, in case we will retry */
+ oldfound = tarstats.nfound;
+ olderror = tarstats.nerror;
+
if (status != SET_OK) {
/* This might force a redraw.... */
clearok(curscr, 1);
@@ -1151,8 +1155,14 @@ get_and_unpack_sets(int update, msg setupdone_msg, msg success_msg, msg failure_
/* Try to extract this set */
status = extract_file(dist, update);
- if (status == SET_RETRY)
+ if (status == SET_RETRY) {
+ /* do this set again */
dist--;
+ /* and reset statistics to what we had before this
+ * set */
+ tarstats.nfound = oldfound;
+ tarstats.nerror = olderror;
+ }
}
#ifdef MD_SET_EXTRACT_FINALIZE