From 08dadc292de9a1210afe9467015e280ae2629847 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 27 Oct 1995 15:25:42 +0000 Subject: attempt to open name as given incase it is a relative pathname --- sbin/disklabel/disklabel.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sbin') 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; -- cgit v1.2.3