Source-Changes-HG archive

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

[src/trunk]: src/sbin/gpt Initialize device_name before opendisk to avoid



details:   https://anonhg.NetBSD.org/src/rev/66237b81bb31
branches:  trunk
changeset: 752231:66237b81bb31
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Feb 20 08:47:10 2010 +0000

description:
Initialize device_name before opendisk to avoid
"unable to open device '(null)'" error messages
when the opendisk fails.

diffstat:

 sbin/gpt/gpt.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 08ce45270414 -r 66237b81bb31 sbin/gpt/gpt.c
--- a/sbin/gpt/gpt.c    Sat Feb 20 06:20:46 2010 +0000
+++ b/sbin/gpt/gpt.c    Sat Feb 20 08:47:10 2010 +0000
@@ -31,7 +31,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.9 2009/02/07 18:12:22 uebayasi Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.10 2010/02/20 08:47:10 mlelstv Exp $");
 #endif
 
 #include <sys/param.h>
@@ -676,10 +676,10 @@
  found:
 #endif
 #ifdef __NetBSD__
+       device_name = device_path + strlen(_PATH_DEV);
        fd = opendisk(dev, mode, device_path, sizeof(device_path), 0);
        if (fd == -1)
                return -1;
-       device_name = device_path + strlen(_PATH_DEV);
 #endif
 
        if (fstat(fd, &sb) == -1)



Home | Main Index | Thread Index | Old Index