src: stop checking virIdentityNew return value

This method will always succeed.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-08-05 19:03:19 +01:00
parent 821414f0cd
commit 1280a631ef
3 changed files with 3 additions and 12 deletions

View File

@ -2192,7 +2192,7 @@ remoteDispatchConnectSetIdentity(virNetServer *server G_GNUC_UNUSED,
int nparams = 0;
int rv = -1;
virConnectPtr conn = remoteGetHypervisorConn(client);
g_autoptr(virIdentity) ident = NULL;
g_autoptr(virIdentity) ident = virIdentityNew();
if (!conn)
goto cleanup;
@ -2209,9 +2209,6 @@ remoteDispatchConnectSetIdentity(virNetServer *server G_GNUC_UNUSED,
if (virConnectSetIdentityEnsureACL(conn) < 0)
goto cleanup;
if (!(ident = virIdentityNew()))
goto cleanup;
if (virIdentitySetParameters(ident, params, nparams) < 0)
goto cleanup;

View File

@ -747,10 +747,7 @@ virNetServerClientCreateIdentity(virNetServerClient *client)
g_autofree char *username = NULL;
g_autofree char *groupname = NULL;
g_autofree char *seccontext = NULL;
g_autoptr(virIdentity) ret = NULL;
if (!(ret = virIdentityNew()))
return NULL;
g_autoptr(virIdentity) ret = virIdentityNew();
if (client->sock && virNetSocketIsLocal(client->sock)) {
gid_t gid;

View File

@ -313,15 +313,12 @@ virIdentity *virIdentityGetSystem(void)
g_autofree char *username = NULL;
g_autofree char *groupname = NULL;
unsigned long long startTime;
g_autoptr(virIdentity) ret = NULL;
g_autoptr(virIdentity) ret = virIdentityNew();
#if WITH_SELINUX
char *con;
#endif
g_autofree char *token = NULL;
if (!(ret = virIdentityNew()))
return NULL;
if (virIdentitySetProcessID(ret, getpid()) < 0)
return NULL;