From 02577b66359fd932511fde36508eb7da55a09746 Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 21 Jul 2000 18:26:20 +0000 Subject: Fix a really stupid bug where I assumed sizeof(int) == 2. This resulted in MBR's with a 4th slice failing the signature check and fdisk saying that they are invalid. Submitted by: bde --- sbin/fdisk/fdisk.c | 2 +- sbin/i386/fdisk/fdisk.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sbin') diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 723db8d..ae339aa 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -794,7 +794,7 @@ read_s0() warnx("can't read fdisk partition table"); return -1; } - if (*(int *)&mboot.bootinst[MBRSIGOFF] != BOOT_MAGIC) { + if (*(uint16_t *)&mboot.bootinst[MBRSIGOFF] != BOOT_MAGIC) { warnx("invalid fdisk partition table found"); /* So should we initialize things */ return -1; diff --git a/sbin/i386/fdisk/fdisk.c b/sbin/i386/fdisk/fdisk.c index 723db8d..ae339aa 100644 --- a/sbin/i386/fdisk/fdisk.c +++ b/sbin/i386/fdisk/fdisk.c @@ -794,7 +794,7 @@ read_s0() warnx("can't read fdisk partition table"); return -1; } - if (*(int *)&mboot.bootinst[MBRSIGOFF] != BOOT_MAGIC) { + if (*(uint16_t *)&mboot.bootinst[MBRSIGOFF] != BOOT_MAGIC) { warnx("invalid fdisk partition table found"); /* So should we initialize things */ return -1; -- cgit v1.1