diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-05-28 14:19:18 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-07-04 22:53:49 +0200 |
commit | 7e69d90c8d38d00ab6bc40073957108107ca2100 (patch) | |
tree | ce84102f4f0d29fcfe7a71de3216f2531d25a0cd | |
parent | aaae57139bfb2f03fef9a8a60ff2ce8191e60459 (diff) | |
download | systemd-7e69d90c8d38d00ab6bc40073957108107ca2100.tar.gz |
varlink: add varlink server to event loop only if there is one
-rw-r--r-- | src/shared/varlink.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/shared/varlink.c b/src/shared/varlink.c index 4ecb763f08..54d48991e8 100644 --- a/src/shared/varlink.c +++ b/src/shared/varlink.c @@ -2052,12 +2052,14 @@ int varlink_server_add_connection(VarlinkServer *server, int fd, Varlink **ret) varlink_set_state(v, VARLINK_IDLE_SERVER); - r = varlink_attach_event(v, server->event, server->event_priority); - if (r < 0) { - varlink_log_errno(v, r, "Failed to attach new connection: %m"); - v->fd = -1; /* take the fd out of the connection again */ - varlink_close(v); - return r; + if (server->event) { + r = varlink_attach_event(v, server->event, server->event_priority); + if (r < 0) { + varlink_log_errno(v, r, "Failed to attach new connection: %m"); + v->fd = -1; /* take the fd out of the connection again */ + varlink_close(v); + return r; + } } if (ret) |