Module Name:    src
Committed By:   mlelstv
Date:           Sat Jul 25 10:37:22 UTC 2015

Modified Files:
        src/sbin/newfs: newfs.c
        src/usr.sbin/installboot: installboot.c

Log Message:
Handle getfsspecname errors.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sbin/newfs/newfs.c
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/installboot/installboot.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/newfs/newfs.c
diff -u src/sbin/newfs/newfs.c:1.112 src/sbin/newfs/newfs.c:1.113
--- src/sbin/newfs/newfs.c:1.112	Sat Oct 25 16:47:23 2014
+++ src/sbin/newfs/newfs.c	Sat Jul 25 10:37:22 2015
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #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 @@ main(int argc, char *argv[])
 				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);

Index: src/usr.sbin/installboot/installboot.c
diff -u src/usr.sbin/installboot/installboot.c:1.38 src/usr.sbin/installboot/installboot.c:1.39
--- src/usr.sbin/installboot/installboot.c:1.38	Fri Jun  5 07:44:39 2015
+++ src/usr.sbin/installboot/installboot.c	Sat Jul 25 10:37:22 2015
@@ -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 @@ main(int argc, char *argv[])
 
 #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;

Reply via email to