From 41a5566c4726f6d490901df2b43d90a26f7b1ec0 Mon Sep 17 00:00:00 2001 From: Jean Guyomarc'h Date: Sat, 2 May 2015 10:04:28 -0400 Subject: [PATCH] e_ipc: fix creation of IPC server when $DISPLAY is a path Summary: Some implementations of the X server (e.g. Xquartz) define their $DISPLAY as a path. Since ecore_ipc_server_add() does not create non-existant directories, and since it may not worth to hide the socket in a complex path, this patch aims at reducing the $DISPLAY by only keeping its basename. Reviewers: zmike Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2465 --- src/bin/e_ipc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c index 40db225f9..ffda798fd 100644 --- a/src/bin/e_ipc.c +++ b/src/bin/e_ipc.c @@ -16,7 +16,7 @@ e_ipc_init(void) { #ifdef USE_IPC char buf[4096], buf2[128], buf3[4096]; - char *tmp, *user, *disp, *base; + char *tmp, *user, *disp, *disp2, *base; int pid, trynum = 0, id1 = 0; struct stat st; @@ -71,7 +71,13 @@ e_ipc_init(void) disp = getenv("DISPLAY"); if (!disp) disp = ":0"; - + else + { + /* $DISPLAY may be a path (e.g. Xquartz), keep the basename. */ + disp2 = strrchr(disp, '/'); + if (disp2) disp = disp2 + 1; + } + e_util_env_set("E_IPC_SOCKET", ""); pid = (int)getpid();