summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-06-17 06:57:07 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-06-17 06:57:07 +0000
commit8f5613ff537cf3ac99c1e03727ab23a360bd5568 (patch)
treeba225b9b772bf0e98eb5826c46b61c937309fed7
parentee154c4142f9e6ce067e41b7ce6a4f341b007281 (diff)
Switch over to generic opendev(3).
-rw-r--r--sbin/disklabel/Makefile4
-rw-r--r--sbin/disklabel/disklabel.c25
2 files changed, 8 insertions, 21 deletions
diff --git a/sbin/disklabel/Makefile b/sbin/disklabel/Makefile
index 697d50d257e..f33c98475ec 100644
--- a/sbin/disklabel/Makefile
+++ b/sbin/disklabel/Makefile
@@ -1,9 +1,11 @@
-# $OpenBSD: Makefile,v 1.4 1996/06/12 08:02:43 downsj Exp $
+# $OpenBSD: Makefile,v 1.5 1996/06/17 06:57:05 downsj Exp $
# $NetBSD: Makefile,v 1.18 1995/10/17 16:34:04 cgd Exp $
# @(#)Makefile 8.2 (Berkeley) 3/17/94
PROG= disklabel
SRCS= disklabel.c dkcksum.c
+DPADD= ${LIBUTIL}
+LDADD= -lutil
MAN= disklabel.5 disklabel.8
.if ${MACHINE} == "amiga"
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 429b2857729..8faa22f8613 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.9 1996/06/12 08:02:44 downsj Exp $ */
+/* $OpenBSD: disklabel.c,v 1.10 1996/06/17 06:57:06 downsj Exp $ */
/* $NetBSD: disklabel.c,v 1.30 1996/03/14 19:49:24 ghudson Exp $ */
/*
@@ -48,7 +48,7 @@ static char copyright[] =
/* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */
static char sccsid[] = "@(#)disklabel.c 8.2 (Berkeley) 1/7/94";
#else
-static char rcsid[] = "$NetBSD: disklabel.c,v 1.30 1996/03/14 19:49:24 ghudson Exp $";
+static char rcsid[] = "$OpenBSD: disklabel.c,v 1.10 1996/06/17 06:57:06 downsj Exp $";
#endif
#endif /* not lint */
@@ -70,6 +70,7 @@ static char rcsid[] = "$NetBSD: disklabel.c,v 1.30 1996/03/14 19:49:24 ghudson E
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <opendev.h>
#include <unistd.h>
#include "pathnames.h"
@@ -230,24 +231,8 @@ 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, 'a' + RAW_PART);
- specname = np;
- np += strlen(specname) + 1;
- } 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;
- f = open(specname, op == READ ? O_RDONLY : O_RDWR);
- }
+ f = opendev(dkname, (op == READ ? O_RDONLY : O_RDWR), OPENDEV_PART,
+ 0600, &specname);
if (f < 0)
err(4, "%s", specname);