summaryrefslogtreecommitdiff
path: root/src/bin/e_ipc.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-08-19 12:01:39 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-08-19 12:01:39 +0900
commitcde60c58407f33e3f4fced5244a35583062d1c12 (patch)
tree8d39a8c0883a445ff5f49e05ed95ddb7fd7950c1 /src/bin/e_ipc.c
parenta1407ca224b7e3b4d798479a414926d2e79dd9c0 (diff)
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
Diffstat (limited to 'src/bin/e_ipc.c')
-rw-r--r--src/bin/e_ipc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c
index 6058a3c..e786e26 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
9 9
10/* local subsystem globals */ 10/* local subsystem globals */
11static Ecore_Ipc_Server *_e_ipc_server = NULL; 11static Ecore_Ipc_Server *_e_ipc_server = NULL;
12static Eina_Stringshare *_e_ipc_dir = NULL;
12#endif 13#endif
13 14
14/* externally accessible functions */ 15/* externally accessible functions */
@@ -80,6 +81,7 @@ e_ipc_init(void)
80 if (!mkdir(buf, S_IRWXU)) 81 if (!mkdir(buf, S_IRWXU))
81 { 82 {
82#ifdef USE_IPC 83#ifdef USE_IPC
84 _e_ipc_dir = eina_stringshare_add(buf);
83 snprintf(buf3, sizeof(buf3), "%s/%i", 85 snprintf(buf3, sizeof(buf3), "%s/%i",
84 buf, pid); 86 buf, pid);
85 _e_ipc_server = ecore_ipc_server_add 87 _e_ipc_server = ecore_ipc_server_add
@@ -96,6 +98,12 @@ e_ipc_init(void)
96#ifdef USE_IPC 98#ifdef USE_IPC
97 if (!_e_ipc_server) 99 if (!_e_ipc_server)
98 { 100 {
101 if (_e_ipc_dir)
102 {
103 ecore_file_recursive_rm(_e_ipc_dir);
104 eina_stringshare_del(_e_ipc_dir);
105 _e_ipc_dir = NULL;
106 }
99 ERR("Gave up after 4096 sockets in '%s'. All failed", base); 107 ERR("Gave up after 4096 sockets in '%s'. All failed", base);
100 return 0; 108 return 0;
101 } 109 }
@@ -122,6 +130,12 @@ e_ipc_shutdown(void)
122 ecore_ipc_server_del(_e_ipc_server); 130 ecore_ipc_server_del(_e_ipc_server);
123 _e_ipc_server = NULL; 131 _e_ipc_server = NULL;
124 } 132 }
133 if (_e_ipc_dir)
134 {
135 ecore_file_recursive_rm(_e_ipc_dir);
136 eina_stringshare_del(_e_ipc_dir);
137 _e_ipc_dir = NULL;
138 }
125#endif 139#endif
126 E_FREE(e_ipc_socket); 140 E_FREE(e_ipc_socket);
127 return 1; 141 return 1;