summaryrefslogtreecommitdiff
path: root/sbin/tunefs
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-23 19:19:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-23 19:19:31 +0000
commitc10750cf11d5188fefdbb251666560c63f567b49 (patch)
treecf4bf88d121eebd22a523f6c2c8663fedbab3bf1 /sbin/tunefs
parent05d4eb3f8a6fd3603419f079bcedc86152bb5b97 (diff)
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/tunefs')
-rw-r--r--sbin/tunefs/tunefs.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c
index e363ff97afb..283450b44d7 100644
--- a/sbin/tunefs/tunefs.c
+++ b/sbin/tunefs/tunefs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tunefs.c,v 1.38 2015/10/12 02:01:15 deraadt Exp $ */
+/* $OpenBSD: tunefs.c,v 1.39 2015/11/23 19:19:30 deraadt Exp $ */
/* $NetBSD: tunefs.c,v 1.33 2005/01/19 20:46:16 xtraeme Exp $ */
/*
@@ -147,6 +147,14 @@ main(int argc, char *argv[])
if (argc != 1)
usage();
+ if (Nflag)
+ if (pledge("stdio rpath disklabel", NULL) == -1)
+ err(1, "pledge");
+ else {
+ if (pledge("stdio rpath wpath disklabel", NULL) == -1)
+ err(1, "pledge");
+ }
+
special = argv[0];
openflags = Nflag ? O_RDONLY : O_RDWR;
if (Fflag)