mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
net: leaseshelper: Ignore corrupted lease file and rewrite it
Instead of reporting an error and terminating, rewrite the file with the newly learned info.
This commit is contained in:
parent
f1385e222e
commit
45d51681ce
@ -274,14 +274,14 @@ main(int argc, char **argv)
|
|||||||
if (custom_lease_file_len) {
|
if (custom_lease_file_len) {
|
||||||
if (!(leases_array = virJSONValueFromString(lease_entries))) {
|
if (!(leases_array = virJSONValueFromString(lease_entries))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("invalid json in file: %s"), custom_lease_file);
|
_("invalid json in file: %s, rewriting it"),
|
||||||
goto cleanup;
|
custom_lease_file);
|
||||||
}
|
} else {
|
||||||
|
if ((size = virJSONValueArraySize(leases_array)) < 0) {
|
||||||
if ((size = virJSONValueArraySize(leases_array)) < 0) {
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
_("couldn't fetch array of leases"));
|
||||||
_("couldn't fetch array of leases"));
|
goto cleanup;
|
||||||
goto cleanup;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user