Module Name:    src
Committed By:   martin
Date:           Sun Jul 14 16:12:02 UTC 2019

Modified Files:
        src/usr.sbin/sysinst: partman.c

Log Message:
Limit the number of menu entries in extended partitioning to the
pre-allocated storage.
Minor cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/partman.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/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.37 src/usr.sbin/sysinst/partman.c:1.38
--- src/usr.sbin/sysinst/partman.c:1.37	Sun Jul 14 15:36:57 2019
+++ src/usr.sbin/sysinst/partman.c	Sun Jul 14 16:12:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.37 2019/07/14 15:36:57 martin Exp $ */
+/*	$NetBSD: partman.c,v 1.38 2019/07/14 16:12:02 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -2683,10 +2683,23 @@ pm_menufmt(menudesc *m, int opt, void *a
 				mount_point = msg_string(MSG_pmmounted);
 			else
 				mount_point = msg_string(MSG_pmunused);
-			fstype = getfslabelname(info.fs_type, info.fs_sub_type);
-			snprintf(buf, STRSIZE, "%s (%s) %s",
-				info.last_mounted, fstype, mount_point);
-			pm_fmt_disk_line(m->mw, dev, buf, info.size, NULL);
+			fstype = getfslabelname(info.fs_type,
+			    info.fs_sub_type);
+			if (info.last_mounted != NULL) {
+				snprintf(buf, STRSIZE, "%s (%s) %s",
+				    info.last_mounted, fstype,
+				     mount_point);
+				pm_fmt_disk_line(m->mw, dev, buf,
+				    info.size, NULL);
+			} else {
+				if (fstype != NULL) {
+					strlcat(dev, " (", sizeof(dev));
+					strlcat(dev, fstype, sizeof(dev));
+					strlcat(dev, ")", sizeof(dev));
+				}
+				pm_fmt_disk_line(m->mw, dev, NULL,
+				    info.size, NULL);
+			}
 			break;
 		case PM_SPEC:
 			/* XXX ? */
@@ -2820,6 +2833,8 @@ pm_upddevlist(menudesc *m, void *arg)
 					continue;
 				if (info.fs_type == FS_UNUSED)
 					continue;
+				if (i >= MAX_ENTRIES)
+					break;
 				i++;
 				m->opts[i].opt_name = NULL;
 				m->opts[i].opt_exp_name = NULL;
@@ -2841,6 +2856,8 @@ pm_upddevlist(menudesc *m, void *arg)
 					continue;
 				if (info.fs_type == FS_UNUSED)
 					continue;
+				if (i >= MAX_ENTRIES)
+					break;
 				i++;
 				m->opts[i].opt_name = NULL;
 				m->opts[i].opt_exp_name = NULL;

Reply via email to