[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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

Attachment: pgp7vp9o2WHKj.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]