libfdisk: (dos) add ID related debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2017-02-27 13:44:08 +01:00
parent ea4ea332a8
commit 168950e3ce
1 changed files with 7 additions and 2 deletions

View File

@ -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);