summaryrefslogtreecommitdiffstats
path: root/sbin/fsirand
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-11-23 19:19:29 +0000
committerderaadt <deraadt@openbsd.org>2015-11-23 19:19:29 +0000
commite384f6efb1362a0010a16f79ac0fdd849ba6c5b9 (patch)
treec672412418866bc6b4506eac75048ed46fbf23ab /sbin/fsirand
parent"random generation numbers" -> "randomly generated numbers" (diff)
downloadwireguard-openbsd-e384f6efb1362a0010a16f79ac0fdd849ba6c5b9.tar.xz
wireguard-openbsd-e384f6efb1362a0010a16f79ac0fdd849ba6c5b9.zip
Use pledge "disklabel" as needed. The theory here is these tools become more
resistant against memory correctup, if a corrupt filesystem is given to them. ok krw
Diffstat (limited to 'sbin/fsirand')
-rw-r--r--sbin/fsirand/fsirand.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index 24475d40719..e39b0b1ee47 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsirand.c,v 1.36 2015/11/18 15:36:32 deraadt Exp $ */
+/* $OpenBSD: fsirand.c,v 1.37 2015/11/23 19:19:30 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -106,6 +106,9 @@ fsirand(char *device)
u_int32_t bsize = DEV_BSIZE;
struct disklabel label;
+ if (pledge("stdio rpath wpath disklabel", NULL) == -1)
+ err(1, "pledge");
+
if ((devfd = opendev(device, printonly ? O_RDONLY : O_RDWR,
0, &devpath)) < 0) {
warn("Can't open %s", devpath);