From 550bfec4261fe18cb660f4466b7cc502de90bc2e Mon Sep 17 00:00:00 2001 From: deraadt Date: Mon, 12 Oct 2015 01:43:52 +0000 Subject: [PATCH] pledge "stdio" right after opening the device. The remainder is is just read, write, fsync, and close. ok doug --- sbin/clri/clri.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)) -- 2.20.1