From 6062a0f6764dcb672b9bb4bc6ca94f5885c3b06d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 30 Jul 2020 13:29:07 +1000 Subject: [PATCH] libei: take the LIBEI_SOCKET variable if the socket path is NULL Signed-off-by: Peter Hutterer --- src/libei-socket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libei-socket.c b/src/libei-socket.c index f4bcd4a..9884e8b 100644 --- a/src/libei-socket.c +++ b/src/libei-socket.c @@ -76,13 +76,17 @@ _public_ int ei_socket_init(struct ei *ei, const char *socketpath) { assert(ei); - assert(socketpath); - assert(socketpath[0] != '\0'); int rc = ei_init(ei); if (rc) return -rc; + if (!socketpath) + socketpath = getenv("LIBEI_SOCKET"); + + assert(socketpath); + assert(socketpath[0] != '\0'); + _cleanup_free_ char *path; if (socketpath[0] == '/') { path = xstrdup(socketpath);