mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
wiping: issue error if libblkid detects signature and fails to return offset/length
We need both offset and length when trying to wipe detected signatures. The libblkid can fail so it's good to have an error message issued for this state instead of being silent (libblkid does not issue any error messages here). We just issued "stack" here before but that was not quite useful if some error occurs...
This commit is contained in:
parent
cb595a5a13
commit
2b9d25133e
@ -1,5 +1,6 @@
|
||||
Version 2.02.106 -
|
||||
====================================
|
||||
Issue error if libbblkid detects signature and fails to return offset/length.
|
||||
Update autoconf config.guess/sub to 2014-01-01.
|
||||
Online thin pool metadata resize requires 1.10 kernel thin pool target.
|
||||
|
||||
|
@ -452,6 +452,8 @@ out:
|
||||
static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name,
|
||||
int exclude_lvm_member, int yes, force_t force)
|
||||
{
|
||||
static const char* msg_failed_offset = "Failed to get offset of the %s signature on %s.";
|
||||
static const char* msg_failed_length = "Failed to get length of the %s signature on %s.";
|
||||
const char *offset = NULL, *type = NULL, *magic = NULL,
|
||||
*usage = NULL, *label = NULL, *uuid = NULL;
|
||||
loff_t offset_value;
|
||||
@ -461,13 +463,23 @@ static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name,
|
||||
if (exclude_lvm_member &&
|
||||
(!strcmp(type, "LVM1_member") || !strcmp(type, "LVM2_member")))
|
||||
return 1;
|
||||
if (!blkid_probe_lookup_value(probe, "SBMAGIC_OFFSET", &offset, NULL) &&
|
||||
blkid_probe_lookup_value(probe, "SBMAGIC", &magic, &len))
|
||||
return_0;
|
||||
if (blkid_probe_lookup_value(probe, "SBMAGIC_OFFSET", &offset, NULL)) {
|
||||
log_error(msg_failed_offset, type, name);
|
||||
return 0;
|
||||
}
|
||||
if (blkid_probe_lookup_value(probe, "SBMAGIC", &magic, &len)) {
|
||||
log_error(msg_failed_length, type, name);
|
||||
return 0;
|
||||
}
|
||||
} else if (!blkid_probe_lookup_value(probe, "PTTYPE", &type, NULL)) {
|
||||
if (!blkid_probe_lookup_value(probe, "PTMAGIC_OFFSET", &offset, NULL) &&
|
||||
blkid_probe_lookup_value(probe, "PTMAGIC", &magic, &len))
|
||||
return_0;
|
||||
if (blkid_probe_lookup_value(probe, "PTMAGIC_OFFSET", &offset, NULL)) {
|
||||
log_error(msg_failed_offset, type, name);
|
||||
return 0;
|
||||
}
|
||||
if (blkid_probe_lookup_value(probe, "PTMAGIC", &magic, &len)) {
|
||||
log_error(msg_failed_length, type, name);
|
||||
return 0;
|
||||
}
|
||||
usage = "partition table";
|
||||
} else
|
||||
return_0;
|
||||
|
Loading…
Reference in New Issue
Block a user