virNetServerAddService() return value
is invariant, so change it type and remove all dependent
checks.
Fixes: 7d2fd6ef01 ("Do not check return value of VIR_EXPAND_N")
Signed-off-by: Artem Chernyshev <artem.chernyshev(a)red-soft.ru>
---
src/lxc/lxc_controller.c | 3 +--
src/rpc/virnetserver.c | 25 +++++--------------------
src/rpc/virnetserver.h | 2 +-
tests/virnetdaemontest.c | 6 ++----
4 files changed, 9 insertions(+), 27 deletions(-)
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 48f5c73fce..0a92a24fb7 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -947,8 +947,7 @@ static int virLXCControllerSetupServer(virLXCController *ctrl)
if (virSecurityManagerClearSocketLabel(ctrl->securityManager, ctrl->def) <
0)
goto error;
- if (virNetServerAddService(srv, svc) < 0)
- goto error;
+ virNetServerAddService(srv, svc);
g_clear_pointer(&svc, virObjectUnref);
if (!(ctrl->prog = virNetServerProgramNew(VIR_LXC_MONITOR_PROGRAM,
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 770476c1a6..a6c6443c55 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -513,10 +513,7 @@ virNetServerNewPostExecRestart(virJSONValue *object,
if (!(service = virNetServerServiceNewPostExecRestart(child)))
return NULL;
- if (virNetServerAddService(srv, service) < 0) {
- virObjectUnref(service);
- return NULL;
- }
+ virNetServerAddService(srv, service);
}
@@ -623,7 +620,7 @@ virNetServerPreExecRestart(virNetServer *srv)
}
-int
+void
virNetServerAddService(virNetServer *srv,
virNetServerService *svc)
{
@@ -633,7 +630,6 @@ virNetServerAddService(virNetServer *srv,
srv->services[srv->nservices-1] = virObjectRef(svc);
virNetServerServiceSetDispatcher(svc, virNetServerDispatchNewClient, srv);
- return 0;
}
@@ -669,10 +665,7 @@ virNetServerAddServiceActivation(virNetServer *srv,
if (!svc)
return -1;
- if (virNetServerAddService(srv, svc) < 0) {
- virObjectUnref(svc);
- return -1;
- }
+ virNetServerAddService(srv, svc);
}
/* Intentionally return 1 any time activation is present,
@@ -723,11 +716,7 @@ virNetServerAddServiceTCP(virNetServer *srv,
nrequests_client_max)))
return -1;
- if (virNetServerAddService(srv, svc) < 0) {
- virObjectUnref(svc);
- return -1;
- }
-
+ virNetServerAddService(srv, svc);
virObjectUnref(svc);
return 0;
@@ -772,11 +761,7 @@ virNetServerAddServiceUNIX(virNetServer *srv,
nrequests_client_max)))
return -1;
- if (virNetServerAddService(srv, svc) < 0) {
- virObjectUnref(svc);
- return -1;
- }
-
+ virNetServerAddService(srv, svc);
virObjectUnref(svc);
return 0;
diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
index 9f0cf3a3fc..dc60e2c2b2 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -59,7 +59,7 @@ void virNetServerShutdownWait(virNetServer *srv);
virJSONValue *virNetServerPreExecRestart(virNetServer *srv);
-int virNetServerAddService(virNetServer *srv,
+void virNetServerAddService(virNetServer *srv,
virNetServerService *svc);
int virNetServerAddServiceTCP(virNetServer *srv,
virSystemdActivation *act,
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index 110ec748f8..74c20479d4 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -127,10 +127,8 @@ testCreateServer(const char *server_name, const char *host, int
family)
5)))
goto error;
- if (virNetServerAddService(srv, svc1) < 0)
- goto error;
- if (virNetServerAddService(srv, svc2) < 0)
- goto error;
+ virNetServerAddService(srv, svc1);
+ virNetServerAddService(srv, svc2);
if (virNetSocketNewConnectSockFD(fdclient[0], &sk1) < 0)
goto error;
--
2.43.0