Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Handle getfsspecname errors.



details:   https://anonhg.NetBSD.org/src/rev/f9efd4d4b4c9
branches:  trunk
changeset: 809639:f9efd4d4b4c9
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Jul 25 10:37:22 2015 +0000

description:
Handle getfsspecname errors.

diffstat:

 sbin/newfs/newfs.c                 |  12 +++++++-----
 usr.sbin/installboot/installboot.c |   6 ++++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diffs (60 lines):

diff -r d8fb205761da -r f9efd4d4b4c9 sbin/newfs/newfs.c
--- a/sbin/newfs/newfs.c        Sat Jul 25 08:43:41 2015 +0000
+++ b/sbin/newfs/newfs.c        Sat Jul 25 10:37:22 2015 +0000
@@ -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);
diff -r d8fb205761da -r f9efd4d4b4c9 usr.sbin/installboot/installboot.c
--- a/usr.sbin/installboot/installboot.c        Sat Jul 25 08:43:41 2015 +0000
+++ b/usr.sbin/installboot/installboot.c        Sat Jul 25 10:37:22 2015 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index