From 9b99195d5e43fcef7f199f910ad0ac81fce230b4 Mon Sep 17 00:00:00 2001 From: krw Date: Tue, 19 Oct 2021 19:38:10 +0000 Subject: [PATCH] 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. --- sbin/fdisk/fdisk.c | 14 +++++++++----- 1 file 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); -- 2.20.1