[virt-tools-list] [PATCH] Fix virt_viewer_app_activate return value

Christophe Fergeau cfergeau at redhat.com
Thu Jun 14 16:29:11 UTC 2012


Hey,

On Thu, Jun 14, 2012 at 05:06:06PM +0200, Michal Privoznik wrote:
> The recent patch tried to fix return values
> of this function. However, it resulted in swapped return values,
> since if we were previously returning TRUE (1) we are now returning
> FALSE (0). Fix this.

I'm actually a bit confused with virt_viewer_app_activate semantics,
if you look at virt_viewer_app_activate , it returns -1 on error, but
when you look at virt-viewer.c:515 (which you pointed me at), the code is:


ret = virt_viewer_update_display(self, dom);
if (ret >= 0)
    ret = VIRT_VIEWER_APP_CLASS(virt_viewer_parent_class)->initial_connect(app);
if (ret < 0) {
    if (priv->waitvm) {
        virt_viewer_app_show_status(app, _("Waiting for guest domain to start server"));
        virt_viewer_app_trace(app, "Guest %s has not activated its display yet, waiting for it to start\n",
                              priv->domkey);
    } else {
        DEBUG_LOG("Failed to activate viewer");
        goto cleanup;
    }
} else if (ret == 0) {
    DEBUG_LOG("Failed to activate viewer");
    ret = -1;
    goto cleanup;
}

(initial_connect is the same as activate in the VirtViewerApp class)

which handles both -1 and 0 as errors, so maybe the initial code was correct ?

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20120614/c67e2660/attachment.sig>


More information about the virt-tools-list mailing list