summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2011-07-05 18:34:10 +0000
committerkrw <krw@openbsd.org>2011-07-05 18:34:10 +0000
commitd1a7c33f6c4180f3302e51e2a03aaa4a1214adec (patch)
tree83477d7d2d17c0c4735bbb544e3418bdfbe3fc5c /sys
parentplug in mmap_write_self (diff)
downloadwireguard-openbsd-d1a7c33f6c4180f3302e51e2a03aaa4a1214adec.tar.xz
wireguard-openbsd-d1a7c33f6c4180f3302e51e2a03aaa4a1214adec.zip
Don't write /boot to sector 0 on non-floppy devices. Non-floppy
devices must have an OpenBSD MBR partition to install /boot into. But search anything except floppy devices (e.g. vnd) for such a partition. Feedback & ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/stand/installboot/installboot.c10
-rw-r--r--sys/arch/i386/stand/installboot/installboot.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/sys/arch/amd64/stand/installboot/installboot.c b/sys/arch/amd64/stand/installboot/installboot.c
index 1877b07bbdd..0434eeed25a 100644
--- a/sys/arch/amd64/stand/installboot/installboot.c
+++ b/sys/arch/amd64/stand/installboot/installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: installboot.c,v 1.21 2011/07/05 17:38:54 krw Exp $ */
+/* $OpenBSD: installboot.c,v 1.22 2011/07/05 18:34:10 krw Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
@@ -233,9 +233,11 @@ write_bootblocks(int devfd, struct disklabel *dl)
sync(); sleep(1);
}
- if (dl->d_type != 0 && dl->d_type != DTYPE_FLOPPY &&
- dl->d_type != DTYPE_VND) {
- /* Find OpenBSD partition. */
+ /*
+ * Find OpenBSD partition. Floppies are special, getting an
+ * everything-in-one /boot starting at sector 0.
+ */
+ if (dl->d_type != DTYPE_FLOPPY) {
start = findopenbsd(devfd, dl);
if (start == (u_int)-1)
errx(1, "no OpenBSD partition");
diff --git a/sys/arch/i386/stand/installboot/installboot.c b/sys/arch/i386/stand/installboot/installboot.c
index cf43ed3a60e..5beecb783f3 100644
--- a/sys/arch/i386/stand/installboot/installboot.c
+++ b/sys/arch/i386/stand/installboot/installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: installboot.c,v 1.64 2011/07/05 17:38:54 krw Exp $ */
+/* $OpenBSD: installboot.c,v 1.65 2011/07/05 18:34:10 krw Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
@@ -229,9 +229,11 @@ write_bootblocks(int devfd, struct disklabel *dl)
sync(); sleep(1);
}
- if (dl->d_type != 0 && dl->d_type != DTYPE_FLOPPY &&
- dl->d_type != DTYPE_VND) {
- /* Find OpenBSD partition. */
+ /*
+ * Find OpenBSD partition. Floppies are special, getting an
+ * everything-in-one /boot starting at sector 0.
+ */
+ if (dl->d_type != DTYPE_FLOPPY) {
start = findopenbsd(devfd, dl);
if (start == (u_int)-1)
errx(1, "no OpenBSD partition");