diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-11-26 19:03:11 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-11-26 19:03:11 +0000 |
commit | 4cd11c4dbaee3a4787bdbc6f3c3e70b8fd337453 (patch) | |
tree | b8c77eaf85bde6794e733086f6717351f5de13a1 | |
parent | fd42d389364f410db18dfe948d807b16249c13e7 (diff) |
Apply pledge.
The people I asked to review this did not get back to me, so
we will test this a different way.
-rw-r--r-- | usr.sbin/installboot/i386_installboot.c | 8 | ||||
-rw-r--r-- | usr.sbin/installboot/installboot.c | 5 | ||||
-rw-r--r-- | usr.sbin/installboot/landisk_installboot.c | 5 | ||||
-rw-r--r-- | usr.sbin/installboot/sparc64_installboot.c | 5 | ||||
-rw-r--r-- | usr.sbin/installboot/vax_installboot.c | 5 |
5 files changed, 13 insertions, 15 deletions
diff --git a/usr.sbin/installboot/i386_installboot.c b/usr.sbin/installboot/i386_installboot.c index 6bbf514b59d..b18def5828c 100644 --- a/usr.sbin/installboot/i386_installboot.c +++ b/usr.sbin/installboot/i386_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i386_installboot.c,v 1.16 2015/11/03 11:38:41 jsg Exp $ */ +/* $OpenBSD: i386_installboot.c,v 1.17 2015/11/26 19:03:10 deraadt Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -180,8 +180,7 @@ write_bootblocks(int devfd, char *dev, struct disklabel *dl) pbr_set_symbols(stage1, blkstore, pbr_symbols); if (!nowrite) { - /* Sync filesystems (to clean in-memory superblock?). */ - sync(); sleep(1); + fsync(devfd); sleep(1); } /* @@ -638,8 +637,7 @@ getbootparams(char *boot, int devfd, struct disklabel *dl) * to be able to load it later. */ - /* Make sure the (probably new) boot file is on disk. */ - sync(); sleep(1); + fsync(devfd); sleep(1); if ((fd = open(boot, O_RDONLY)) < 0) err(1, "open: %s", boot); diff --git a/usr.sbin/installboot/installboot.c b/usr.sbin/installboot/installboot.c index 50d027355c1..33e33a7be8e 100644 --- a/usr.sbin/installboot/installboot.c +++ b/usr.sbin/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.9 2015/10/14 00:19:04 krw Exp $ */ +/* $OpenBSD: installboot.c,v 1.10 2015/11/26 19:03:10 deraadt Exp $ */ /* * Copyright (c) 2012, 2013 Joel Sing <jsing@openbsd.org> @@ -51,6 +51,9 @@ main(int argc, char **argv) char *dev, *realdev; int devfd, opt; + if (pledge("stdio rpath wpath cpath fattr disklabel", NULL) == -1) + err(1, "pledge"); + md_init(); while ((opt = getopt(argc, argv, "nr:v")) != -1) { diff --git a/usr.sbin/installboot/landisk_installboot.c b/usr.sbin/installboot/landisk_installboot.c index a8de186a41f..30df58a107a 100644 --- a/usr.sbin/installboot/landisk_installboot.c +++ b/usr.sbin/installboot/landisk_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: landisk_installboot.c,v 1.5 2015/10/15 19:27:30 miod Exp $ */ +/* $OpenBSD: landisk_installboot.c,v 1.6 2015/11/26 19:03:10 deraadt Exp $ */ /* * Copyright (c) 2013 Joel Sing <jsing@openbsd.org> @@ -40,8 +40,7 @@ md_loadboot(void) void md_installboot(int devfd, char *dev) { - /* XXX - is this necessary? */ - sync(); + fsync(devfd); bootldr = fileprefix(root, bootldr); if (bootldr == NULL) diff --git a/usr.sbin/installboot/sparc64_installboot.c b/usr.sbin/installboot/sparc64_installboot.c index f68eec070f7..85f37e1f370 100644 --- a/usr.sbin/installboot/sparc64_installboot.c +++ b/usr.sbin/installboot/sparc64_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sparc64_installboot.c,v 1.4 2015/10/08 14:50:38 krw Exp $ */ +/* $OpenBSD: sparc64_installboot.c,v 1.5 2015/11/26 19:03:10 deraadt Exp $ */ /* * Copyright (c) 2012, 2013 Joel Sing <jsing@openbsd.org> @@ -92,8 +92,7 @@ md_loadboot(void) void md_installboot(int devfd, char *dev) { - /* XXX - is this necessary? */ - sync(); + fsync(devfd); bootldr = fileprefix(root, bootldr); if (bootldr == NULL) diff --git a/usr.sbin/installboot/vax_installboot.c b/usr.sbin/installboot/vax_installboot.c index e002a970660..2914d230dc4 100644 --- a/usr.sbin/installboot/vax_installboot.c +++ b/usr.sbin/installboot/vax_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vax_installboot.c,v 1.2 2015/10/15 19:27:30 miod Exp $ */ +/* $OpenBSD: vax_installboot.c,v 1.3 2015/11/26 19:03:10 deraadt Exp $ */ /* * Copyright (c) 2013 Joel Sing <jsing@openbsd.org> @@ -40,8 +40,7 @@ md_loadboot(void) void md_installboot(int devfd, char *dev) { - /* XXX - is this necessary? */ - sync(); + fsync(devfd); bootldr = fileprefix(root, bootldr); if (bootldr == NULL) |