Sat Jul 25 10:37:22 2015 UTC ()
Handle getfsspecname errors.


(mlelstv)
diff -r1.112 -r1.113 src/sbin/newfs/newfs.c
diff -r1.38 -r1.39 src/usr.sbin/installboot/installboot.c

cvs diff -r1.112 -r1.113 src/sbin/newfs/newfs.c (expand / switch to context diff)
--- src/sbin/newfs/newfs.c 2014/10/25 16:47:23 1.112
+++ src/sbin/newfs/newfs.c 2015/07/25 10:37:22 1.113
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs.c,v 1.112 2014/10/25 16:47:23 mlelstv Exp $	*/
+/*	$NetBSD: newfs.c,v 1.113 2015/07/25 10:37:22 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@
 #if 0
 static char sccsid[] = "@(#)newfs.c	8.13 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: newfs.c,v 1.112 2014/10/25 16:47:23 mlelstv Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.113 2015/07/25 10:37:22 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -493,9 +493,11 @@
 				fso = fsi;
 		}
 	} else {	/* !Fflag && !mfs */
-		special = getfsspecname(specname, sizeof(specname), special);
-		raw = getdiskrawname(rawname, sizeof(rawname), special);
-		if (raw != NULL)
+		raw = getfsspecname(specname, sizeof(specname), special);
+		if (raw == NULL)
+			err(1, "%s: %s", special, specname);
+		special = getdiskrawname(rawname, sizeof(rawname), raw);
+		if (special == NULL)
 			special = raw;
 
 		fsi = opendisk(special, O_RDONLY, device, sizeof(device), 0);

cvs diff -r1.38 -r1.39 src/usr.sbin/installboot/installboot.c (expand / switch to context diff)
--- src/usr.sbin/installboot/installboot.c 2015/06/05 07:44:39 1.38
+++ src/usr.sbin/installboot/installboot.c 2015/07/25 10:37:22 1.39
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.38 2015/06/05 07:44:39 mlelstv Exp $	*/
+/*	$NetBSD: installboot.c,v 1.39 2015/07/25 10:37:22 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(__lint)
-__RCSID("$NetBSD: installboot.c,v 1.38 2015/06/05 07:44:39 mlelstv Exp $");
+__RCSID("$NetBSD: installboot.c,v 1.39 2015/07/25 10:37:22 mlelstv Exp $");
 #endif	/* !__lint */
 
 #include <sys/param.h>
@@ -240,6 +240,8 @@
 
 #if !HAVE_NBTOOL_CONFIG_H
 	special = getfsspecname(specname, sizeof(specname), argv[0]);
+	if (special == NULL)
+		err(1, "%s: %s", argv[0], specname);
 	raw = getdiskrawname(rawname, sizeof(rawname), special);
 	if (raw != NULL)
 		special = raw;