libei: take the LIBEI_SOCKET variable if the socket path is NULL

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-07-30 13:29:07 +10:00
parent b1231dfa1f
commit 6062a0f676

View file

@ -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);