From: Lennart Poettering Date: Tue, 28 May 2019 12:19:18 +0000 (+0200) Subject: varlink: add varlink server to event loop only if there is one X-Git-Tag: v243-rc1~192 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7e69d90c8d38d00ab6bc40073957108107ca2100;p=thirdparty%2Fsystemd.git varlink: add varlink server to event loop only if there is one --- diff --git a/src/shared/varlink.c b/src/shared/varlink.c index 4ecb763f082..54d48991e85 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)