Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst renumber_partitions() needs to deal with re...



details:   https://anonhg.NetBSD.org/src/rev/2759e00a08e6
branches:  trunk
changeset: 367677:2759e00a08e6
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jun 21 15:45:03 2022 +0000

description:
renumber_partitions() needs to deal with removed/added partitions.

diffstat:

 usr.sbin/sysinst/label.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r b0c3b1f21914 -r 2759e00a08e6 usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c  Tue Jun 21 15:42:43 2022 +0000
+++ b/usr.sbin/sysinst/label.c  Tue Jun 21 15:45:03 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.39 2022/06/20 16:06:38 martin Exp $        */
+/*     $NetBSD: label.c,v 1.40 2022/06/21 15:45:03 martin Exp $        */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.39 2022/06/20 16:06:38 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.40 2022/06/21 15:45:03 martin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -508,7 +508,7 @@
                if (!pset->parts->pscheme->get_part_info(pset->parts, pno,
                    &info))
                        continue;
-               for (i = 0; i < pset->parts->num_part; i++) {
+               for (i = 0; i < pset->num; i++) {
                        if (pset->infos[i].cur_start != info.start)
                                continue;
                        if (pset->infos[i].cur_flags != info.flags)
@@ -525,8 +525,9 @@
                }
        }
 
-       memcpy(pset->infos, ninfos, sizeof(*pset->infos)*pset->parts->num_part);
-       free(ninfos);
+       free(pset->infos);
+       pset->infos = ninfos;
+       pset->num = pset->parts->num_part;
 }
 
 /*



Home | Main Index | Thread Index | Old Index