]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: correctly initialize pointer to sun label
authorKarel Zak <kzak@redhat.com>
Mon, 28 Jan 2013 09:37:45 +0000 (10:37 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 11 Mar 2013 12:00:54 +0000 (13:00 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisksunlabel.c

index ecb6c1c55ca94b6539976e18793d1cf78356fdd4..3c450ae1f5e2a6b96249c44e5e2d948c2241f0e2 100644 (file)
@@ -137,11 +137,15 @@ static int sun_probe_label(struct fdisk_context *cxt)
        assert(cxt->label);
        assert(fdisk_is_disklabel(cxt, SUN));
 
-       sunlabel = self_disklabel(cxt);
+       /* map first sector to header */
+       sun = (struct fdisk_sun_label *) cxt->label;
+       sun->header = (struct sun_disk_label *) cxt->firstsector;
+       sunlabel = sun->header;
 
        if (sunlabel->magic != SUN_LABEL_MAGIC &&
            sunlabel->magic != SUN_LABEL_MAGIC_SWAPPED) {
                other_endian = 0;
+               sun->header = NULL;
                return 0;               /* failed */
        }