Re: [PATCH] Fix virt_viewer_app_activate return value

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

 



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: pgp5b8M1RDB87.pgp
Description: PGP signature


[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux