usr/src/lib/libzfs/common/libzfs_pool.c
changeset 6289 9a83171c70d6
parent 5621 cd0984d5b1c1
child 6423 437422a29d3a
--- a/usr/src/lib/libzfs/common/libzfs_pool.c	Wed Mar 26 09:44:21 2008 -0700
+++ b/usr/src/lib/libzfs/common/libzfs_pool.c	Wed Mar 26 09:44:41 2008 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -2566,6 +2566,10 @@
 	diskaddr_t start_block;
 	char errbuf[1024];
 
+	/* prepare an error message just in case */
+	(void) snprintf(errbuf, sizeof (errbuf),
+	    dgettext(TEXT_DOMAIN, "cannot label '%s'"), name);
+
 	if (zhp) {
 		nvlist_t *nvroot;
 
@@ -2590,8 +2594,8 @@
 		 * This shouldn't happen.  We've long since verified that this
 		 * is a valid device.
 		 */
-		zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "cannot "
-		    "label '%s': unable to open device"), name);
+		zfs_error_aux(hdl,
+		    dgettext(TEXT_DOMAIN, "unable to open device"));
 		return (zfs_error(hdl, EZFS_OPENFAILED, errbuf));
 	}
 
@@ -2604,8 +2608,8 @@
 			(void) no_memory(hdl);
 
 		(void) close(fd);
-		zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "cannot "
-		    "label '%s': unable to read disk capacity"), name);
+		zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+		    "unable to read disk capacity"), name);
 
 		return (zfs_error(hdl, EZFS_NOCAP, errbuf));
 	}
@@ -2645,8 +2649,7 @@
 		efi_free(vtoc);
 
 		zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-		    "cannot label '%s': try using fdisk(1M) and then "
-		    "provide a specific slice"), name);
+		    "try using fdisk(1M) and then provide a specific slice"));
 		return (zfs_error(hdl, EZFS_LABELFAILED, errbuf));
 	}