rpc: virnetserver: virNetServerAddService() to void

virNetServerAddService() return value is invariant, so change it
type and remove all dependent checks.

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Artem Chernyshev 2024-01-04 03:16:58 +03:00 committed by Michal Privoznik
parent 46c9458654
commit bce48d99a7
4 changed files with 10 additions and 28 deletions

View File

@ -947,8 +947,7 @@ static int virLXCControllerSetupServer(virLXCController *ctrl)
if (virSecurityManagerClearSocketLabel(ctrl->securityManager, ctrl->def) < 0) if (virSecurityManagerClearSocketLabel(ctrl->securityManager, ctrl->def) < 0)
goto error; goto error;
if (virNetServerAddService(srv, svc) < 0) virNetServerAddService(srv, svc);
goto error;
g_clear_pointer(&svc, virObjectUnref); g_clear_pointer(&svc, virObjectUnref);
if (!(ctrl->prog = virNetServerProgramNew(VIR_LXC_MONITOR_PROGRAM, if (!(ctrl->prog = virNetServerProgramNew(VIR_LXC_MONITOR_PROGRAM,

View File

@ -513,10 +513,7 @@ virNetServerNewPostExecRestart(virJSONValue *object,
if (!(service = virNetServerServiceNewPostExecRestart(child))) if (!(service = virNetServerServiceNewPostExecRestart(child)))
return NULL; return NULL;
if (virNetServerAddService(srv, service) < 0) { virNetServerAddService(srv, service);
virObjectUnref(service);
return NULL;
}
} }
@ -623,7 +620,7 @@ virNetServerPreExecRestart(virNetServer *srv)
} }
int void
virNetServerAddService(virNetServer *srv, virNetServerAddService(virNetServer *srv,
virNetServerService *svc) virNetServerService *svc)
{ {
@ -633,7 +630,6 @@ virNetServerAddService(virNetServer *srv,
srv->services[srv->nservices-1] = virObjectRef(svc); srv->services[srv->nservices-1] = virObjectRef(svc);
virNetServerServiceSetDispatcher(svc, virNetServerDispatchNewClient, srv); virNetServerServiceSetDispatcher(svc, virNetServerDispatchNewClient, srv);
return 0;
} }
@ -669,10 +665,7 @@ virNetServerAddServiceActivation(virNetServer *srv,
if (!svc) if (!svc)
return -1; return -1;
if (virNetServerAddService(srv, svc) < 0) { virNetServerAddService(srv, svc);
virObjectUnref(svc);
return -1;
}
} }
/* Intentionally return 1 any time activation is present, /* Intentionally return 1 any time activation is present,
@ -723,11 +716,7 @@ virNetServerAddServiceTCP(virNetServer *srv,
nrequests_client_max))) nrequests_client_max)))
return -1; return -1;
if (virNetServerAddService(srv, svc) < 0) { virNetServerAddService(srv, svc);
virObjectUnref(svc);
return -1;
}
virObjectUnref(svc); virObjectUnref(svc);
return 0; return 0;
@ -772,11 +761,7 @@ virNetServerAddServiceUNIX(virNetServer *srv,
nrequests_client_max))) nrequests_client_max)))
return -1; return -1;
if (virNetServerAddService(srv, svc) < 0) { virNetServerAddService(srv, svc);
virObjectUnref(svc);
return -1;
}
virObjectUnref(svc); virObjectUnref(svc);
return 0; return 0;

View File

@ -59,8 +59,8 @@ void virNetServerShutdownWait(virNetServer *srv);
virJSONValue *virNetServerPreExecRestart(virNetServer *srv); virJSONValue *virNetServerPreExecRestart(virNetServer *srv);
int virNetServerAddService(virNetServer *srv, void virNetServerAddService(virNetServer *srv,
virNetServerService *svc); virNetServerService *svc);
int virNetServerAddServiceTCP(virNetServer *srv, int virNetServerAddServiceTCP(virNetServer *srv,
virSystemdActivation *act, virSystemdActivation *act,
const char *actname, const char *actname,

View File

@ -127,10 +127,8 @@ testCreateServer(const char *server_name, const char *host, int family)
5))) 5)))
goto error; goto error;
if (virNetServerAddService(srv, svc1) < 0) virNetServerAddService(srv, svc1);
goto error; virNetServerAddService(srv, svc2);
if (virNetServerAddService(srv, svc2) < 0)
goto error;
if (virNetSocketNewConnectSockFD(fdclient[0], &sk1) < 0) if (virNetSocketNewConnectSockFD(fdclient[0], &sk1) < 0)
goto error; goto error;