+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
#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"
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);
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;