summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/disklabel/disklabel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 6df09b23881..98845511b14 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -233,6 +233,11 @@ main(argc, argv)
usage();
dkname = argv[0];
+ f = open(dkname, op == READ ? O_RDONLY : O_RDWR);
+ if (f != -1) {
+ specname = dkname;
+ goto ok;
+ }
if (dkname[0] != '/') {
(void)sprintf(np, "%sr%s%c", _PATH_DEV, dkname, RAWPARTITION);
specname = np;
@@ -240,6 +245,7 @@ main(argc, argv)
} else
specname = dkname;
f = open(specname, op == READ ? O_RDONLY : O_RDWR);
+ok:
if (f < 0 && errno == ENOENT && dkname[0] != '/') {
(void)sprintf(specname, "%sr%s", _PATH_DEV, dkname);
np = namebuf + strlen(specname) + 1;