libei: Do not abort if LIBEI_SOCKET is not set

When called with NULL as the path to the EI socket, the function
ei_setup_backend_socket() will fallback to the LIBEI_SOCKET environment
variable to determine the path to the socket.

If that environment variable is not set, ei_setup_backend_socket() will
abort.

That means that an innocent client running in an environment without EI
support will be killed. If that client happens to be Xwayland, that would
abort the Xserver and take all X11 clients with it, including the window
manager itself in the case of mutter.

Return -ENOENT instead so that clients have a chance to recover and
survive the lack of EI support.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
This commit is contained in:
Olivier Fourdan 2020-09-15 11:33:53 +02:00 committed by Peter Hutterer
parent 24a74f1b26
commit 325d7e6a43

View file

@ -83,8 +83,8 @@ ei_setup_backend_socket(struct ei *ei, const char *socketpath)
if (!socketpath)
socketpath = getenv("LIBEI_SOCKET");
assert(socketpath);
assert(socketpath[0] != '\0');
if (!socketpath || socketpath[0] == '\0')
return -ENOENT;
_cleanup_free_ char *path = NULL;
if (socketpath[0] == '/') {