From: Karel Zak Date: Mon, 27 Feb 2017 12:44:08 +0000 (+0100) Subject: libfdisk: (dos) add ID related debug messages X-Git-Tag: v2.30-rc1~206 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=168950e3ce10555fc70ef56451d3dd2d07893965;p=thirdparty%2Futil-linux.git libfdisk: (dos) add ID related debug messages Signed-off-by: Karel Zak --- diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c index 69090706a8..11946b38cb 100644 --- a/libfdisk/src/dos.c +++ b/libfdisk/src/dos.c @@ -640,14 +640,19 @@ static int dos_create_disklabel(struct fdisk_context *cxt) if (s) { errno = 0; id = strtol(s, &end, 16); - if (!errno && end && s < end) + if (!errno && end && s < end) { has_id = 1; + DBG(LABEL, ul_debug("DOS: re-use ID from script (0x%08x)", id)); + } else + DBG(LABEL, ul_debug("DOS: failed to parse label=id '%s'", s)); } } /* random disk signature */ - if (!has_id) + if (!has_id) { + DBG(LABEL, ul_debug("DOS: generate new ID")); random_get_bytes(&id, sizeof(id)); + } if (fdisk_has_protected_bootbits(cxt)) rc = fdisk_init_firstsector_buffer(cxt, 0, MBR_PT_BOOTBITS_SIZE);