summaryrefslogtreecommitdiff
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2021-10-19 19:38:11 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2021-10-19 19:38:11 +0000
commit16c4f596886dd92c5f233b085f8b052a086d02dc (patch)
tree743403c75fecbc0ea1a9a8df1bcf1f8a202ff1a4 /sbin/fdisk
parent68fc7780466c7ff7d0ca2e73860c5243f4289248 (diff)
Move get_default_mbr() invocation before DISK_open() invocation and remove
"rpath wpath" from the pledge() invocation. Makes default_dmbr information available to DISK_open(). No intentional functional change.
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/fdisk.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index 24a056a4bc1..854966a9233 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdisk.c,v 1.139 2021/10/13 13:18:57 krw Exp $ */
+/* $OpenBSD: fdisk.c,v 1.140 2021/10/19 19:38:10 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -144,6 +144,8 @@ main(int argc, char *argv[])
if (init || e_flag)
oflags = O_RDWR;
+ get_default_dmbr(mbrfile);
+
DISK_open(argv[0], oflags);
if (oflags == O_RDONLY) {
if (pledge("stdio", NULL) == -1)
@@ -152,12 +154,14 @@ main(int argc, char *argv[])
goto done;
}
- /* "proc exec" for man page display */
- if (pledge("stdio rpath wpath disklabel proc exec", NULL) == -1)
+ /*
+ * "stdio" to talk to the outside world.
+ * "proc exec" for man page display.
+ * "disklabel" for DIOCRLDINFO.
+ */
+ if (pledge("stdio disklabel proc exec", NULL) == -1)
err(1, "pledge");
- get_default_dmbr(mbrfile);
-
switch (init) {
case INIT_GPT:
GPT_init(GHANDGP);