Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Do not allow editing of start/size/fs-type ...



details:   https://anonhg.NetBSD.org/src/rev/5e757b0ec941
branches:  trunk
changeset: 983212:5e757b0ec941
user:      martin <martin%NetBSD.org@localhost>
date:      Sun May 09 11:06:20 2021 +0000

description:
Do not allow editing of start/size/fs-type for partitions that
are already carved in stone (e.g. defined in an outer MBR while we are
editing the inner disklabel).

diffstat:

 usr.sbin/sysinst/label.c |  23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diffs (54 lines):

diff -r 3ade1da63e83 -r 5e757b0ec941 usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c  Sun May 09 10:39:00 2021 +0000
+++ b/usr.sbin/sysinst/label.c  Sun May 09 11:06:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: label.c,v 1.32 2021/01/31 22:45:46 rillig Exp $        */
+/*     $NetBSD: label.c,v 1.33 2021/05/09 11:06:20 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.32 2021/01/31 22:45:46 rillig Exp $");
+__RCSID("$NetBSD: label.c,v 1.33 2021/05/09 11:06:20 martin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1070,9 +1070,23 @@
                            edit->pset->parts, edit->id, attr_no))
                                continue;
                }
+               /*
+                * Do not allow editing of size/start/type when partition
+                * is defined in some outer partition table already
+                */
+               if ((edit->pset->infos[edit->index].flags & PUIFLG_IS_OUTER)
+                   && (m->opts[i].opt_action == edit_fs_type
+                       || m->opts[i].opt_action == edit_fs_start
+                       || m->opts[i].opt_action == edit_fs_size))
+                               continue;
                /* Ok: we want this one */
                m->opts[i].opt_flags &= ~OPT_IGNORE;
        }
+
+       /* Avoid starting at a (now) disabled menu item */
+       while (m->cursel >= 0 && m->cursel < m->numopts
+           && (m->opts[m->cursel].opt_flags & OPT_IGNORE))
+               m->cursel++;
 }
 
 static void
@@ -1123,7 +1137,10 @@
 
        if (m->opts[opt].opt_flags & OPT_IGNORE
            && (opt != 3 || edit->info.fs_type == FS_UNUSED)
-           && m->opts[opt].opt_action != edit_ptn_custom_type) {
+           && m->opts[opt].opt_action != edit_ptn_custom_type
+           && m->opts[opt].opt_action != edit_fs_type
+           && m->opts[opt].opt_action != edit_fs_start
+           && m->opts[opt].opt_action != edit_fs_size) {
                wprintw(m->mw, "%*s -", col_width, "");
                return;
        }



Home | Main Index | Thread Index | Old Index