Source-Changes-HG archive

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

[src/netbsd-9]: src/usr.sbin/sysinst Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/af09d1b2bba4
branches:  netbsd-9
changeset: 460433:af09d1b2bba4
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 23 06:03:24 2019 +0000

description:
Pull up following revision(s) (requested by martin in ticket #364):
        usr.sbin/sysinst/disklabel.c: revision 1.14
When translating (internal) indices to device names, properly deal with
gaps in partition allocations (e.g. no swap partition).

diffstat:

 usr.sbin/sysinst/disklabel.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r f631505d57eb -r af09d1b2bba4 usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c      Wed Oct 23 06:01:55 2019 +0000
+++ b/usr.sbin/sysinst/disklabel.c      Wed Oct 23 06:03:24 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.10.2.3 2019/08/18 13:22:49 msaitoh Exp $       */
+/*     $NetBSD: disklabel.c,v 1.10.2.4 2019/10/23 06:03:24 msaitoh Exp $       */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -717,6 +717,8 @@
                                continue;
                        if (parts->l.d_partitions[i].p_fstype == FS_UNUSED)
                                continue;
+                       if (parts->l.d_partitions[i].p_size == 0)
+                               continue;
 
                        s = parts->l.d_partitions[i].p_offset;
                        e = parts->l.d_partitions[i].p_size + s;
@@ -823,11 +825,17 @@
        if (ptn >= parts->l.d_npartitions)
                return false;
 
-       for (id = part_index = 0; id < ptn &&
-           part_index < parts->l.d_npartitions; part_index++)
-               if (parts->l.d_partitions[part_index].p_fstype != FS_UNUSED ||
-                   parts->l.d_partitions[part_index].p_size != 0)
-                       id++;
+       for (id = part_index = 0; part_index < parts->l.d_npartitions;
+           part_index++) {
+               if (parts->l.d_partitions[part_index].p_fstype == FS_UNUSED &&
+                   parts->l.d_partitions[part_index].p_size == 0)
+                       continue;
+               if (id == ptn)
+                       break;
+               id++;
+               if (id > ptn)
+                       return false;
+       }
 
        if (part != 0)
                *part = part_index;



Home | Main Index | Thread Index | Old Index