Source-Changes-HG archive

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

[src/trunk]: src/sbin/gpt Only skip past _PATH_DEV if it is actually present.



details:   https://anonhg.NetBSD.org/src/rev/e03d8fcd57c6
branches:  trunk
changeset: 791546:e03d8fcd57c6
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Sat Nov 23 08:59:04 2013 +0000

description:
Only skip past _PATH_DEV if it is actually present.

diffstat:

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

diffs (27 lines):

diff -r 65c923b79312 -r e03d8fcd57c6 sbin/gpt/gpt.c
--- a/sbin/gpt/gpt.c    Fri Nov 22 21:56:24 2013 +0000
+++ b/sbin/gpt/gpt.c    Sat Nov 23 08:59:04 2013 +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.22 2013/11/20 08:08:47 jnemeth Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.23 2013/11/23 08:59:04 jnemeth Exp $");
 #endif
 
 #include <sys/param.h>
@@ -695,10 +695,13 @@
  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;
+       if (strncmp(device_path, _PATH_DEV, strlen(_PATH_DEV)) == 0)
+               device_name = device_path + strlen(_PATH_DEV);
+       else
+               device_name = device_path;
 #endif
 
        if (fstat(fd, &sb) == -1)



Home | Main Index | Thread Index | Old Index