summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);