[libvirt] [PATCH 1/5]: Shore up virGetLastError handling

While doing testing on this patch series, I mistakenly added a bogus piece of storage XML to libvirtd, which was saved in /etc/libvirt/storage. On subsequent stop/start of libvirtd, because of another bug (fixed in a later patch), 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>

On Tue, Oct 21, 2008 at 03:56:48PM +0200, Chris Lalancette wrote:
While doing testing on this patch series, I mistakenly added a bogus piece of storage XML to libvirtd, which was saved in /etc/libvirt/storage. On subsequent stop/start of libvirtd, because of another bug (fixed in a later patch), 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.
ACK. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Daniel P. Berrange wrote:
On Tue, Oct 21, 2008 at 03:56:48PM +0200, Chris Lalancette wrote:
While doing testing on this patch series, I mistakenly added a bogus piece of storage XML to libvirtd, which was saved in /etc/libvirt/storage. On subsequent stop/start of libvirtd, because of another bug (fixed in a later patch), 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.
ACK.
Committed this. -- Chris Lalancette
participants (2)
-
Chris Lalancette
-
Daniel P. Berrange