[Libvir] [patch 2/2] Dont crash if theres no /sys/hypervisor/capabilities
Daniel Veillard
veillard at redhat.com
Thu Feb 7 10:05:08 UTC 2008
On Wed, Feb 06, 2008 at 11:45:59PM +0000, Mark McLoughlin wrote:
> xenHypervisorMakeCapabilitiesXML() can be called with either
> of it's FILE* paramaters NULL; don't crash when the capabilities
> pointer is NULL.
>
> Signed-off-by: Mark McLoughlin <markmc at redhat.com>
> Index: libvirt/src/xen_internal.c
> ===================================================================
> --- libvirt.orig/src/xen_internal.c 2008-02-06 22:38:06.000000000 +0000
> +++ libvirt/src/xen_internal.c 2008-02-06 23:38:54.000000000 +0000
> @@ -2233,7 +2233,7 @@
> */
>
> /* Expecting one line in this file - ignore any more. */
> - if (fgets (line, sizeof line, capabilities)) {
> + if (capabilities && fgets (line, sizeof line, capabilities)) {
> /* Split the line into tokens. strtok_r is OK here because we "own"
> * this buffer. Parse out the features from each token.
> */
okay, but I still prefer when test expressions are fully parenthetized,
so preferabbly with ()() added, thanks :-)
+1
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
More information about the libvir-list
mailing list