X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=wui_thread.c;h=9dab95c2d29e49eacd0769aa476fc26c9649bd89;hb=838aa4673bea4bf0e33a9e5045e4deba393a317d;hp=2500ccb8d4e83bad53b36a564a5b513439de96c6;hpb=0b9477affd8b7978768ee76bc5631adbec3a2dcf;p=ovirt-viewer.git diff --git a/wui_thread.c b/wui_thread.c index 2500ccb..9dab95c 100644 --- a/wui_thread.c +++ b/wui_thread.c @@ -17,6 +17,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* For an explanation of the threading model, please main(). */ + #include #include @@ -518,10 +520,15 @@ write_fn_start_capture (void) static char * write_fn_finish_capture (void) { - char *ret = write_fn_buffer; + char *ret; ASSERT_IS_WUI_THREAD (); + /* Make sure the buffer is NUL-terminated before returning it. */ + write_fn_buffer = g_realloc (write_fn_buffer, write_fn_len+1); + write_fn_buffer[write_fn_len] = '\0'; + ret = write_fn_buffer; + write_fn_buffer = NULL; write_fn_len = -1; return ret; @@ -970,6 +977,7 @@ parse_vm_from_xml (xmlNodePtr node) vm.hostid = -1; vm.id = -1; vm.vnc_port = -1; + vm.forward_vnc_port = -1; vm.mem_allocated = -1; vm.mem_used = -1; vm.vcpus_allocated = -1; @@ -1046,6 +1054,13 @@ parse_vm_from_xml (xmlNodePtr node) xmlFree (str); } } + else if (xmlStrcmp (p->name, (const xmlChar *) "forward-vnc-port") == 0) { + str = xmlNodeGetContent (p); + if (str != NULL) { + vm.forward_vnc_port = strtol ((char *) str, NULL, 10); + xmlFree (str); + } + } else if (xmlStrcmp (p->name, (const xmlChar *) "vnic-mac-addr") == 0) { str = xmlNodeGetContent (p); if (str != NULL) { @@ -1065,6 +1080,8 @@ parse_vm_from_xml (xmlNodePtr node) DEBUG ("required field \"description\" missing from structure"); else if (vm.vnc_port == -1) DEBUG ("required field \"vnc-port\" missing from structure"); + else if (vm.forward_vnc_port == -1) + DEBUG ("required field \"forward-vnc-port\" missing from structure"); else if (vm.uuid == NULL) DEBUG ("required field \"uuid\" missing from structure"); else