Simplify virt_viewer_auth_libvirt_credentials() return value logic

As the function should return < 0 in error cases, let's explicitly
return/set the return value to -1 in error cases. Otherwise, the
function will return 0.

This patch also fixes a regression introduced by (a5ce2ed3).

https://bugzilla.redhat.com/show_bug.cgi?id=1142742
This commit is contained in:
Fabiano Fidêncio 2014-09-23 16:07:50 +02:00
parent 0107214070
commit 42ffe6f8b4

View File

@ -618,7 +618,7 @@ virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
VirtViewer *app = cbdata;
VirtViewerPrivate *priv = app->priv;
int i;
int ret = -1;
int ret = 0;
g_debug("Got libvirt credential request for %d credential(s)", ncred);
@ -644,10 +644,10 @@ virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
"libvirt",
app->priv->uri,
username, password);
if (priv->auth_cancelled)
if (priv->auth_cancelled) {
ret = -1;
goto cleanup;
} else {
ret = 0;
}
}
for (i = 0 ; i < ncred ; i++) {