[PATCH 4/5] leasehelper: Ignore corrupted lease file and rewrite it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of reporting and error and terminating, rewrite the file with
the newly learned info.
---
 src/network/leaseshelper.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index 99c47a9..d4b48bb 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -274,14 +274,14 @@ main(int argc, char **argv)
     if (custom_lease_file_len) {
         if (!(leases_array = virJSONValueFromString(lease_entries))) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("invalid json in file: %s"), custom_lease_file);
-            goto cleanup;
-        }
-
-        if ((size = virJSONValueArraySize(leases_array)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("couldn't fetch array of leases"));
-            goto cleanup;
+                           _("invalid json in file: %s, rewriting it"),
+                           custom_lease_file);
+        } else {
+            if ((size = virJSONValueArraySize(leases_array)) < 0) {
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                               _("couldn't fetch array of leases"));
+                goto cleanup;
+            }
         }
     }

-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]