From 29a92a49d48481f34afd64a197fb1293fa833f81 Mon Sep 17 00:00:00 2001 From: apb Date: Sun, 23 Dec 2007 08:14:28 +0000 Subject: [PATCH] If the partition is unused, then attempting to decode the PBR would actually decode the MBR from sector 0 of the disk. Don't do it if v_flag < 3. --- sbin/fdisk/fdisk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 9dbf9bdfe95e..99bb6ac5d8bb 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdisk.c,v 1.110 2007/11/29 23:19:25 dsl Exp $ */ +/* $NetBSD: fdisk.c,v 1.111 2007/12/23 08:14:28 apb Exp $ */ /* * Mach Operating System @@ -39,7 +39,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fdisk.c,v 1.110 2007/11/29 23:19:25 dsl Exp $"); +__RCSID("$NetBSD: fdisk.c,v 1.111 2007/12/23 08:14:28 apb Exp $"); #endif /* not lint */ #define MBRPTYPENAMES @@ -746,6 +746,9 @@ print_mbr_partition(struct mbr_sector *boot, int part, partp->mbrp_ehd, MBR_PSECT(partp->mbrp_esect)); } + if (partp->mbrp_type == 0 && start == 0 && v_flag < 3) + return; + if (! MBR_IS_EXTENDED(partp->mbrp_type)) print_pbr(start, indent + 8, partp->mbrp_type);