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
This commit is contained in:
Jean Guyomarc'h 2015-05-02 10:04:28 -04:00 committed by Mike Blumenkrantz
parent 3712189455
commit 41a5566c47
1 changed files with 8 additions and 2 deletions

View File

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