Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jan 2011 05:22:32 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r217257 - user/nwhitehorn/bsdinstall/partedit
Message-ID:  <201101110522.p0B5MWEL007554@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Tue Jan 11 05:22:31 2011
New Revision: 217257
URL: http://svn.freebsd.org/changeset/base/217257

Log:
  More anti-foot-shooting measures: gpart labels do not like to contain
  slashes, so provide a more helpful error message if the user tries
  to set one with a slash in it.
  
  Submitted by:	joel

Modified:
  user/nwhitehorn/bsdinstall/partedit/gpart_ops.c

Modified: user/nwhitehorn/bsdinstall/partedit/gpart_ops.c
==============================================================================
--- user/nwhitehorn/bsdinstall/partedit/gpart_ops.c	Tue Jan 11 04:25:54 2011	(r217256)
+++ user/nwhitehorn/bsdinstall/partedit/gpart_ops.c	Tue Jan 11 05:22:31 2011	(r217257)
@@ -400,6 +400,13 @@ editpart:
 	if (choice) /* Cancel pressed */
 		return;
 
+	/* Check if the label has a / in it */
+	if (strchr(items[3].text, '/') != NULL) {
+		dialog_msgbox("Error", "Label contains a /, which is not an "
+		    "allowed character.", 0, 0, TRUE);
+		goto editpart;
+	}
+
 	if (strncmp(items[0].text, "freebsd-", 8) != 0 &&
 	    items[0].text[0] != '\0') {
 		char message[512];
@@ -648,6 +655,13 @@ addpartform:
 		size = MIN((intmax_t)(bytes/sector), maxsize);
 	}
 
+	/* Check if the label has a / in it */
+	if (strchr(items[3].text, '/') != NULL) {
+		dialog_msgbox("Error", "Label contains a /, which is not an "
+		    "allowed character.", 0, 0, TRUE);
+		goto addpartform;
+	}
+
 	/* Warn if no mountpoint set */
 	if (strcmp(items[0].text, "freebsd-ufs") == 0 &&
 	    items[2].text[0] != '/') {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101110522.p0B5MWEL007554>