Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst If we get the disk description via device p...
details: https://anonhg.NetBSD.org/src/rev/74b09ab89390
branches: trunk
changeset: 366621:74b09ab89390
user: martin <martin%NetBSD.org@localhost>
date: Thu Jun 02 15:36:08 2022 +0000
description:
If we get the disk description via device properties, the strings may
have arbitrary length - make sure the "available disks" menu fits
on the current screen.
diffstat:
usr.sbin/sysinst/disks.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diffs (47 lines):
diff -r 8f29fea706e9 -r 74b09ab89390 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c Thu Jun 02 07:34:39 2022 +0000
+++ b/usr.sbin/sysinst/disks.c Thu Jun 02 15:36:08 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disks.c,v 1.80 2022/05/16 18:44:38 martin Exp $ */
+/* $NetBSD: disks.c,v 1.81 2022/06/02 15:36:08 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -881,6 +881,7 @@
int i = 0, dno, wno, skipped = 0;
int already_found, numdisks, selected_disk = -1;
int menu_no, w_menu_no;
+ size_t max_desc_len;
struct pm_devs *pm_i, *pm_last = NULL;
bool any_wedges = false;
@@ -895,6 +896,13 @@
refresh();
/* Kill typeahead, it won't be what the user had in mind */
fpurge(stdin);
+ /*
+ * we need space for the menu box and the row label,
+ * this sums up to 7 characters.
+ */
+ max_desc_len = getmaxx(stdscr) - 8;
+ if (max_desc_len >= __arraycount(disks[0].dd_descr))
+ max_desc_len = __arraycount(disks[0].dd_descr) - 1;
/*
* partman_go: <0 - we want to see menu with extended partitioning
@@ -923,6 +931,7 @@
any_wedges = true;
wedge_menu[wno].opt_name =
disks[i].dd_descr;
+ disks[i].dd_descr[max_desc_len] = 0;
wedge_menu[wno].opt_flags = OPT_EXIT;
wedge_menu[wno].opt_action =
set_menu_select;
@@ -931,6 +940,7 @@
} else {
dsk_menu[dno].opt_name =
disks[i].dd_descr;
+ disks[i].dd_descr[max_desc_len] = 0;
dsk_menu[dno].opt_flags = OPT_EXIT;
dsk_menu[dno].opt_action =
set_menu_select;
Home |
Main Index |
Thread Index |
Old Index