From cde60c58407f33e3f4fced5244a35583062d1c12 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 19 Aug 2016 12:01:39 +0900 Subject: [PATCH] e ipc - fix cleanup of ipc socket on shutdown e never deleted its ipc dir or socket on shutdown. kind of bad. that means every e rstart meant a new socket dir and file. a bit of a leak when this happens to be often in a ramdisk. this should fix that and have the socket dir and content nicely shut down on a clean shutdown @fix --- src/bin/e_ipc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c index 6058a3cd6..e786e265d 100644 --- a/src/bin/e_ipc.c +++ b/src/bin/e_ipc.c @@ -9,6 +9,7 @@ static Eina_Bool _e_ipc_cb_client_data(void *data EINA_UNUSED, int type EINA_UNU /* local subsystem globals */ static Ecore_Ipc_Server *_e_ipc_server = NULL; +static Eina_Stringshare *_e_ipc_dir = NULL; #endif /* externally accessible functions */ @@ -80,6 +81,7 @@ e_ipc_init(void) if (!mkdir(buf, S_IRWXU)) { #ifdef USE_IPC + _e_ipc_dir = eina_stringshare_add(buf); snprintf(buf3, sizeof(buf3), "%s/%i", buf, pid); _e_ipc_server = ecore_ipc_server_add @@ -96,6 +98,12 @@ e_ipc_init(void) #ifdef USE_IPC if (!_e_ipc_server) { + if (_e_ipc_dir) + { + ecore_file_recursive_rm(_e_ipc_dir); + eina_stringshare_del(_e_ipc_dir); + _e_ipc_dir = NULL; + } ERR("Gave up after 4096 sockets in '%s'. All failed", base); return 0; } @@ -122,6 +130,12 @@ e_ipc_shutdown(void) ecore_ipc_server_del(_e_ipc_server); _e_ipc_server = NULL; } + if (_e_ipc_dir) + { + ecore_file_recursive_rm(_e_ipc_dir); + eina_stringshare_del(_e_ipc_dir); + _e_ipc_dir = NULL; + } #endif E_FREE(e_ipc_socket); return 1;