Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst PR 55752: relax an assertion, the first get...



details:   https://anonhg.NetBSD.org/src/rev/be8f4ec8be75
branches:  trunk
changeset: 941680:be8f4ec8be75
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Oct 26 20:18:33 2020 +0000

description:
PR 55752: relax an assertion, the first getvfsstat() call may overestimate
the file systems visible to us.

diffstat:

 usr.sbin/sysinst/util.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 53b93d4e1778 -r be8f4ec8be75 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c   Mon Oct 26 20:14:27 2020 +0000
+++ b/usr.sbin/sysinst/util.c   Mon Oct 26 20:18:33 2020 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index