rpc: Change return type of virNetClientAddProgram to void

This function return value is invariant since VIR_EXPAND_N check
removal in 7d2fd6e, so change its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Alexander Kuznetsov 2024-11-28 18:21:19 +03:00 committed by Jiri Denemark
parent 5afe228ea7
commit b0da352c58
7 changed files with 11 additions and 18 deletions

View File

@ -214,8 +214,7 @@ remoteAdminPrivNew(const char *sock_path)
NULL, 0, NULL))) NULL, 0, NULL)))
goto error; goto error;
if (virNetClientAddProgram(priv->client, priv->program) < 0) virNetClientAddProgram(priv->client, priv->program);
goto error;
return priv; return priv;
error: error:

View File

@ -213,8 +213,7 @@ static virNetClient *virLockManagerLockDaemonConnectionNew(bool privileged,
NULL))) NULL)))
goto error; goto error;
if (virNetClientAddProgram(client, *prog) < 0) virNetClientAddProgram(client, *prog);
goto error;
return client; return client;

View File

@ -88,8 +88,7 @@ virLogManagerConnect(bool privileged,
NULL))) NULL)))
goto error; goto error;
if (virNetClientAddProgram(client, *prog) < 0) virNetClientAddProgram(client, *prog);
goto error;
VIR_FREE(daemonPath); VIR_FREE(daemonPath);
VIR_FREE(logdpath); VIR_FREE(logdpath);

View File

@ -169,9 +169,7 @@ virLXCMonitor *virLXCMonitorNew(virDomainObj *vm,
mon))) mon)))
goto error; goto error;
if (virNetClientAddProgram(mon->client, virNetClientAddProgram(mon->client, mon->program);
mon->program) < 0)
goto error;
mon->vm = virObjectRef(vm); mon->vm = virObjectRef(vm);
memcpy(&mon->cb, cb, sizeof(mon->cb)); memcpy(&mon->cb, cb, sizeof(mon->cb));

View File

@ -1160,10 +1160,9 @@ doRemoteOpen(virConnectPtr conn,
conn))) conn)))
goto error; goto error;
if (virNetClientAddProgram(priv->client, priv->remoteProgram) < 0 || virNetClientAddProgram(priv->client, priv->remoteProgram);
virNetClientAddProgram(priv->client, priv->lxcProgram) < 0 || virNetClientAddProgram(priv->client, priv->lxcProgram);
virNetClientAddProgram(priv->client, priv->qemuProgram) < 0) virNetClientAddProgram(priv->client, priv->qemuProgram);
goto error;
/* Try and authenticate with server */ /* Try and authenticate with server */
VIR_DEBUG("Trying authentication"); VIR_DEBUG("Trying authentication");

View File

@ -1053,7 +1053,7 @@ bool virNetClientIsOpen(virNetClient *client)
} }
int virNetClientAddProgram(virNetClient *client, void virNetClientAddProgram(virNetClient *client,
virNetClientProgram *prog) virNetClientProgram *prog)
{ {
virObjectLock(client); virObjectLock(client);
@ -1062,7 +1062,6 @@ int virNetClientAddProgram(virNetClient *client,
client->programs[client->nprograms-1] = virObjectRef(prog); client->programs[client->nprograms-1] = virObjectRef(prog);
virObjectUnlock(client); virObjectUnlock(client);
return 0;
} }

View File

@ -117,7 +117,7 @@ int virNetClientDupFD(virNetClient *client, bool cloexec);
bool virNetClientHasPassFD(virNetClient *client); bool virNetClientHasPassFD(virNetClient *client);
int virNetClientAddProgram(virNetClient *client, void virNetClientAddProgram(virNetClient *client,
virNetClientProgram *prog); virNetClientProgram *prog);
int virNetClientAddStream(virNetClient *client, int virNetClientAddStream(virNetClient *client,