summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-27 15:25:42 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-27 15:25:42 +0000
commit08dadc292de9a1210afe9467015e280ae2629847 (patch)
tree76d48f9fec949955053da7d87dec5c4a8a63f9ff /sbin
parente316a8e167d1df3e3aae5a8bcb059de6c089fed5 (diff)
attempt to open name as given incase it is a relative pathname
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;