Module Name:    src
Committed By:   martin
Date:           Sun Jan 26 14:37:29 UTC 2020

Modified Files:
        src/usr.sbin/sysinst: util.c

Log Message:
When retrying sets during extraction, reset the relevant statistics
to avoid counting retried sets multiple times.

Reported by kim.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/sysinst/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.41 src/usr.sbin/sysinst/util.c:1.42
--- src/usr.sbin/sysinst/util.c:1.41	Mon Jan 20 21:26:35 2020
+++ src/usr.sbin/sysinst/util.c	Sun Jan 26 14:37:29 2020
@@ -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 setu
 {
 	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 setu
 		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 setu
 
 		/* 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

Reply via email to