Module Name: src Committed By: martin Date: Sun May 9 11:06:20 UTC 2021
Modified Files: src/usr.sbin/sysinst: label.c Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/sysinst/label.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/sysinst/label.c diff -u src/usr.sbin/sysinst/label.c:1.32 src/usr.sbin/sysinst/label.c:1.33 --- src/usr.sbin/sysinst/label.c:1.32 Sun Jan 31 22:45:46 2021 +++ src/usr.sbin/sysinst/label.c Sun May 9 11:06:20 2021 @@ -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 @@ update_edit_ptn_menu(menudesc *m, void * 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 @@ draw_edit_ptn_line(menudesc *m, int opt, 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; }