summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2015-11-14 00:20:59 +0000
committerkrw <krw@openbsd.org>2015-11-14 00:20:59 +0000
commit7240ce9b7be4e21ae4806551aa4927b3406c9295 (patch)
tree5e750a1d6b20e20d9195d1fd4b61cc6fd391f690
parentIf none of -i, -u or -e are specified exit immediately after the (diff)
downloadwireguard-openbsd-7240ce9b7be4e21ae4806551aa4927b3406c9295.tar.xz
wireguard-openbsd-7240ce9b7be4e21ae4806551aa4927b3406c9295.zip
pledge("stdio", NULL) for code path that just prints the MBR or GPT. i.e.
when none of -i, -e or -u are specified. Prodded by deraadt@
-rw-r--r--sbin/fdisk/fdisk.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index 1521eee9a38..1e2bdaf9931 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdisk.c,v 1.85 2015/11/14 00:13:47 krw Exp $ */
+/* $OpenBSD: fdisk.c,v 1.86 2015/11/14 00:20:59 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -181,6 +181,8 @@ main(int argc, char *argv[])
"to specify.");
if ((i_flag + u_flag + e_flag) == 0) {
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
USER_print_disk();
goto done;
}