diff options
Diffstat (limited to 'sbin/fsck_ffs')
-rw-r--r-- | sbin/fsck_ffs/main.c | 4 | ||||
-rw-r--r-- | sbin/fsck_ffs/setup.c | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 417ea542c3b..0f6b6f7ae28 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.51 2018/01/05 09:33:47 otto Exp $ */ +/* $OpenBSD: main.c,v 1.52 2018/09/24 21:26:02 deraadt Exp $ */ /* $NetBSD: main.c,v 1.22 1996/10/11 20:15:48 thorpej Exp $ */ /* @@ -67,6 +67,8 @@ main(int argc, char *argv[]) int ch; int ret = 0; + checkroot(); + sync(); skipclean = 1; while ((ch = getopt(argc, argv, "dfpnNyYb:c:m:")) != -1) { diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index aa77994f094..0d2a9dcf574 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.64 2018/01/05 09:33:47 otto Exp $ */ +/* $OpenBSD: setup.c,v 1.65 2018/09/24 21:26:02 deraadt Exp $ */ /* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */ /* @@ -102,11 +102,15 @@ setup(char *dev, int isfsdb) strlcpy(rdevname, realdev, sizeof(rdevname)); setcdevname(rdevname, dev, preen); - if (isfsdb || !hotroot()) + if (isfsdb || !hotroot()) { + if (unveil("/dev", "rw") == -1) + err(1, "unveil"); if (pledge("stdio rpath wpath getpw tty disklabel", NULL) == -1) err(1, "pledge"); + } } + if (fstat(fsreadfd, &statb) < 0) { printf("Can't stat %s: %s\n", realdev, strerror(errno)); close(fsreadfd); |