From 689fee8724c94a580600b7ea23b3c869ba0dcdba Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Tue, 16 Jul 2002 23:18:29 +0000 Subject: [PATCH] Fixed some print format errors. Avoid some warnings about possible (but not actual) alignment problems. Both of these bugs were detected on ia64's and were fatal on ia64's due to premature setting of WARNS to 4. --- sbin/fdisk/fdisk.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index cfbf0852b1b..2952903b4a7 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -39,6 +39,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -453,10 +454,10 @@ print_part(int i) part_mb /= (1024 * 1024); printf("sysid %d (%#04x),(%s)\n", partp->dp_typ, partp->dp_typ, get_type(partp->dp_typ)); - printf(" start %lu, size %lu (%qd Meg), flag %x%s\n", + printf(" start %lu, size %lu (%ju Meg), flag %x%s\n", (u_long)partp->dp_start, (u_long)partp->dp_size, - part_mb, + (uintmax_t)part_mb, partp->dp_flag, partp->dp_flag == ACTIVE ? " (active)" : ""); printf("\tbeg: cyl %d/ head %d/ sector %d;\n\tend: cyl %d/ head %d/ sector %d\n" @@ -499,7 +500,7 @@ init_boot(void) if ((mboot.bootinst = malloc(mboot.bootinst_size)) == NULL) errx(1, "unable to allocate boot block buffer"); memset(mboot.bootinst, 0, mboot.bootinst_size); - *(uint16_t *)&mboot.bootinst[MBRSIGOFF] = BOOT_MAGIC; + *(uint16_t *)(void *)&mboot.bootinst[MBRSIGOFF] = BOOT_MAGIC; #endif } @@ -783,7 +784,7 @@ read_s0() warnx("can't read fdisk partition table"); return -1; } - if (*(uint16_t *)&mboot.bootinst[MBRSIGOFF] != BOOT_MAGIC) { + if (*(uint16_t *)(void *)&mboot.bootinst[MBRSIGOFF] != BOOT_MAGIC) { warnx("invalid fdisk partition table found"); /* So should we initialize things */ return -1;