]> xenbits.xensource.com Git - libvirt.git/commitdiff
While doing on this patch series, I mistakenly added a bogus piece of
authorChris Lalancette <clalance@redhat.com>
Tue, 21 Oct 2008 17:15:53 +0000 (17:15 +0000)
committerChris Lalancette <clalance@redhat.com>
Tue, 21 Oct 2008 17:15:53 +0000 (17:15 +0000)
storage XML to libvirtd, which was saved in /etc/libvirt/storage.  On subsequent
stop/start of libvirtd, because of another bug , an
error wasn't being set properly in an error path, so libvirtd was SEGV'ing in
storage_conf.c:virStoragePoolObjLoad when trying to dereference the NULL err
returned from virGetLastError().  Make this more robust against errors by always
doing "err ? err->message : NULL" in the printf.  I looked around the tree and
found a couple of other places that weren't guarded, so this patch fixes them as
well.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
ChangeLog
src/network_driver.c
src/qemu_driver.c
src/storage_conf.c
src/storage_driver.c

index d3b85dac8c641cc521611d1df8e34a949c3afa92..eefc6664eafc90de07a03575e8ee43a1e04c34cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Oct 21 19:13:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
+       * src/qemu_driver.c src/storage_conf.c src/network_driver.c
+         src/storage_driver.c: Shore up the uses of virGetLastError() so that
+         if a path forgets to set a virError, we don't crash while trying
+         to dereference the NULL pointer to print out.
+
 Tue Oct 21 09:19:24 PDT 2008 Dan Smith <danms@us.ibm.com>
        * src/cgroup.c src/cgroup.h: Add function to allow major device range
        * src/lxc_container.h src/controller.c: Fix cgroup initialization
index 411cfde2983a539848e064760a4acf1bfe2d3858..f483a258ab02838861609b222b21ff7ee2b5a505 100644 (file)
@@ -98,7 +98,8 @@ networkAutostartConfigs(struct network_driver *driver) {
             networkStartNetworkDaemon(NULL, driver, driver->networks.objs[i]) < 0) {
             virErrorPtr err = virGetLastError();
             networkLog(NETWORK_ERR, _("Failed to autostart network '%s': %s\n"),
-                       driver->networks.objs[i]->def->name, err->message);
+                       driver->networks.objs[i]->def->name,
+                       err ? err->message : NULL);
         }
     }
 }
index 59d7166a617ff3f4f1c287d46a2a8b85e51f3875..34f743b684988ea20288aa3fc5429737ee8b8ff6 100644 (file)
@@ -136,7 +136,8 @@ qemudAutostartConfigs(struct qemud_driver *driver) {
             qemudStartVMDaemon(NULL, driver, driver->domains.objs[i], NULL) < 0) {
             virErrorPtr err = virGetLastError();
             qemudLog(QEMUD_ERR, _("Failed to autostart VM '%s': %s\n"),
-                     driver->domains.objs[i]->def->name, err->message);
+                     driver->domains.objs[i]->def->name,
+                     err ? err->message : NULL);
         }
     }
 }
index db56b3c79a972cd57ce54fa1b4d2f0ab64bb0b4f..23e7538f0c7b5c9f047ea695d6f49a549f066d29 100644 (file)
@@ -1043,7 +1043,7 @@ virStoragePoolObjLoad(virConnectPtr conn,
     if (!(def = virStoragePoolDefParse(NULL, xml, file))) {
         virErrorPtr err = virGetLastError();
         virStorageLog("Error parsing storage pool config '%s' : %s",
-                      path, err->message);
+                      path, err ? err->message : NULL);
         return NULL;
     }
 
index e0d97e1fb16ade75c88ec8dd604f9c7a305ce70f..077382107032f09fe37db7faca576e0364d9a35a 100644 (file)
@@ -232,7 +232,7 @@ storageDriverShutdown(void) {
                 backend->stopPool(NULL, pool) < 0) {
                 virErrorPtr err = virGetLastError();
                 storageLog("Failed to stop storage pool '%s': %s",
-                           pool->def->name, err->message);
+                           pool->def->name, err ? err->message : NULL);
             }
             virStoragePoolObjClearVols(pool);
         }