+Thu Jan 29 16:41:07 GMT 2009 John Levon <john.levon@sun.com>
+
+ * src/util.c: allow strtol replacements for libvirt proxy
+
+ * src/xend_internal.c: fix VNC port reporting when vncunused
+ is set
+
+ * tests/sexpr2xmldata/sexpr2xml-fv-autoport.sexpr:
+ * tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml:
+ * tests/sexpr2xmltest.c: add a test
+
Thu Jan 29 13:07:05 +0100 2009 Jim Meyering <meyering@redhat.com>
* Makefile.cfg: disable some new checks
*
* convenience function to lookup an int value in the S-Expression
*
- * Returns the value found or 0 if not found (but may not be an error)
+ * Returns the value found or 0 if not found (but may not be an error).
+ * This function suffers from the flaw that zero is both a correct
+ * return value and an error indicator: careful!
*/
static int
sexpr_int(const struct sexpr *sexpr, const char *name)
port = xenStoreDomainGetVNCPort(conn, def->id);
xenUnifiedUnlock(priv);
+ // Didn't find port entry in xenstore
if (port == -1) {
- // Didn't find port entry in xenstore
- port = sexpr_int(node, "device/vfb/vncdisplay");
+ const char *str = sexpr_node(node, "device/vfb/vncdisplay");
+ int val;
+ if (str != NULL && virStrToLong_i(str, NULL, 0, &val) == 0)
+ port = val;
}
- if ((unused && STREQ(unused, "1")) || port == -1) {
+ if ((unused && STREQ(unused, "1")) || port == -1)
graphics->data.vnc.autoport = 1;
- port = -1;
- }
if (port >= 0 && port < 5900)
port += 5900;
DO_TEST("pv-vfb-orig", "pv-vfb-orig", 2);
DO_TEST("pv-vfb-new", "pv-vfb-new", 3);
DO_TEST("pv-vfb-new-vncdisplay", "pv-vfb-new-vncdisplay", 3);
+ DO_TEST("fv-autoport", "fv-autoport", 3);
DO_TEST("pv-bootloader", "pv-bootloader", 1);
DO_TEST("disk-file", "disk-file", 2);