summaryrefslogtreecommitdiff
path: root/sbin/clri
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-12 01:43:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-12 01:43:53 +0000
commit66306797e15bc70263c4ef1142d4aa9c5a252d60 (patch)
treea3c94d66f04773c738d3dff54152e18c340ab2e2 /sbin/clri
parentcb7acb501dd1106a743aada9d2189d01c9d5ce29 (diff)
pledge "stdio" right after opening the device. The remainder is
is just read, write, fsync, and close. ok doug
Diffstat (limited to 'sbin/clri')
-rw-r--r--sbin/clri/clri.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/clri/clri.c b/sbin/clri/clri.c
index 4ad511304dc..a82238f6bad 100644
--- a/sbin/clri/clri.c
+++ b/sbin/clri/clri.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clri.c,v 1.16 2015/02/06 11:49:39 tedu Exp $ */
+/* $OpenBSD: clri.c,v 1.17 2015/10/12 01:43:52 deraadt Exp $ */
/* $NetBSD: clri.c,v 1.19 2005/01/20 15:50:47 xtraeme Exp $ */
/*
@@ -78,6 +78,8 @@ main(int argc, char *argv[])
/* get the superblock. */
if ((fd = open(fs, O_RDWR, 0)) < 0)
err(1, "%s", fs);
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
for (i = 0; sblock_try[i] != -1; i++) {
offset = (off_t)(sblock_try[i]);
if (pread(fd, sblock, sizeof(sblock), offset) != sizeof(sblock))