From b11bbb5a0b5c357816bff424c2a325806d60f20b Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 9 Nov 2020 14:33:37 -0800 Subject: [PATCH 22/42] bsd: Fix gcc complaints when using boot_code pointer --- libparted/labels/bsd.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c index 6946563..8483641 100644 --- a/libparted/labels/bsd.c +++ b/libparted/labels/bsd.c @@ -307,19 +307,16 @@ error: static void _probe_and_add_boot_code (const PedDisk* disk) { - char *old_boot_code; - BSDRawLabel *old_label; + BSDDiskData *old_data; void *s0; if (!ptt_read_sector (disk->dev, 0, &s0)) return; - old_boot_code = ((BSDDiskData*) s0)->boot_code; - old_label = &((BSDDiskData*) s0)->label; - - if (old_boot_code [0] - && old_label->d_magic == PED_CPU_TO_LE32 (BSD_DISKMAGIC)) { + old_data = (BSDDiskData*) s0; + if (old_data->boot_code [0] + && old_data->label.d_magic == PED_CPU_TO_LE32 (BSD_DISKMAGIC)) { BSDDiskData *bsd_specific = (BSDDiskData*) disk->disk_specific; - memcpy (bsd_specific, old_boot_code, sizeof (BSDDiskData)); + memcpy (bsd_specific, old_data, sizeof (BSDDiskData)); } free (s0); } -- 2.26.2