Mon Oct 26 20:18:33 2020 UTC ()
PR 55752: relax an assertion, the first getvfsstat() call may overestimate
the file systems visible to us.


(martin)
diff -r1.50 -r1.51 src/usr.sbin/sysinst/util.c

cvs diff -r1.50 -r1.51 src/usr.sbin/sysinst/util.c (expand / switch to context diff)
--- src/usr.sbin/sysinst/util.c 2020/10/25 08:50:32 1.50
+++ src/usr.sbin/sysinst/util.c 2020/10/26 20:18:33 1.51
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.50 2020/10/25 08:50:32 martin Exp $	*/
+/*	$NetBSD: util.c,v 1.51 2020/10/26 20:18:33 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -515,7 +515,7 @@
 get_available_cds(void)
 {
 	struct get_available_cds_state data;
-	int n, __diagused e;
+	int n, m;
 
 	memset(&data, 0, sizeof data);
 	data.info = cds;
@@ -523,10 +523,10 @@
 	n = getvfsstat(NULL, 0, ST_NOWAIT);
 	if (n > 0) {
 		data.mounted = calloc(n, sizeof(*data.mounted));
-		e = getvfsstat(data.mounted, n*sizeof(*data.mounted),
+		m = getvfsstat(data.mounted, n*sizeof(*data.mounted),
 		    ST_NOWAIT);
-		assert(e == n);
-		data.num_mounted = n;
+		assert(m >= 0 && m <= n);
+		data.num_mounted = m;
 	}
 
 	enumerate_disks(&data, get_available_cds_helper);