[parted-devel] [PATCH 08/24] bsd: Fix gcc complaints when using boot_code pointer

Brian C. Lane bcl at redhat.com
Sat Nov 14 00:11:51 GMT 2020


---
 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




More information about the parted-devel mailing list