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>
+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
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);
}
}
}
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);
}
}
}
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;
}
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);
}