From aace6e9d1ce59fc6298c8a754e180ec00b149671 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 28 Jan 2013 10:37:45 +0100 Subject: [PATCH] fdisk: correctly initialize pointer to sun label Signed-off-by: Karel Zak --- fdisks/fdisksunlabel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fdisks/fdisksunlabel.c b/fdisks/fdisksunlabel.c index ecb6c1c55c..3c450ae1f5 100644 --- a/fdisks/fdisksunlabel.c +++ b/fdisks/fdisksunlabel.c @@ -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 */ } -- 2.47.2