mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
* src/xml.c: markmc pointed out that using number(xpath) could lead
to NaN and following comparison would be wrong in a couple of places if the element looked at was missing. Daniel
This commit is contained in:
parent
098e0a4bdc
commit
d42014f108
@ -1,3 +1,9 @@
|
||||
Thu Aug 10 15:28:52 CEST 2006 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/xml.c: markmc pointed out that using number(xpath) could lead
|
||||
to NaN and following comparison would be wrong in a couple of places
|
||||
if the element looked at was missing.
|
||||
|
||||
Wed Aug 9 10:17:03 EDT 2006 Daniel Berrange <berrange@redhat.com>
|
||||
|
||||
* src/driver.h, src/libvirt.c: Made the virDomainGetXMLDesc
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <math.h> /* for isnan() */
|
||||
#include "internal.h"
|
||||
#include "hash.h"
|
||||
#include "sexpr.h"
|
||||
@ -999,7 +1000,7 @@ virDomainParseXMLDesc(const char *xmldesc, char **name)
|
||||
|
||||
obj = xmlXPathEval(BAD_CAST "number(/domain/memory[1])", ctxt);
|
||||
if ((obj == NULL) || (obj->type != XPATH_NUMBER) ||
|
||||
(obj->floatval < 64000)) {
|
||||
(isnan(obj->floatval)) || (obj->floatval < 64000)) {
|
||||
virBufferVSprintf(&buf, "(memory 128)(maxmem 128)");
|
||||
} else {
|
||||
unsigned long mem = (obj->floatval / 1024);
|
||||
@ -1010,7 +1011,7 @@ virDomainParseXMLDesc(const char *xmldesc, char **name)
|
||||
|
||||
obj = xmlXPathEval(BAD_CAST "number(/domain/vcpu[1])", ctxt);
|
||||
if ((obj == NULL) || (obj->type != XPATH_NUMBER) ||
|
||||
(obj->floatval <= 0)) {
|
||||
(isnan(obj->floatval)) || (obj->floatval <= 0)) {
|
||||
virBufferVSprintf(&buf, "(vcpus 1)");
|
||||
} else {
|
||||
unsigned int cpu = (unsigned int) obj->floatval;
|
||||
|
Loading…
x
Reference in New Issue
Block a user