summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-01-15 19:23:44 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-01-15 19:23:44 +0000
commitee6cc91a03ae264f700bedfbf5c1d20532abc3a1 (patch)
tree4f9f0c4ba76975dcceb7efcbf678693df366c4ca
parenteb72593bbca59541dacf706ceb6d6f0fa29756f4 (diff)
eina - fix eina_strndup test passing
-rw-r--r--src/bin/efreet/efreetd_ipc.c21
-rw-r--r--src/lib/efreet/efreet_cache.c2
-rw-r--r--src/lib/eina/eina_inline_str.x14
3 files changed, 31 insertions, 6 deletions
diff --git a/src/bin/efreet/efreetd_ipc.c b/src/bin/efreet/efreetd_ipc.c
index 933abfca9c..0992345d3f 100644
--- a/src/bin/efreet/efreetd_ipc.c
+++ b/src/bin/efreet/efreetd_ipc.c
@@ -18,6 +18,7 @@ static Ecore_Event_Handler *hnd_add = NULL;
18static Ecore_Event_Handler *hnd_del = NULL; 18static Ecore_Event_Handler *hnd_del = NULL;
19static Ecore_Event_Handler *hnd_data = NULL; 19static Ecore_Event_Handler *hnd_data = NULL;
20static int clients = 0; 20static int clients = 0;
21static Ecore_Timer *quit_timer_start = NULL;
21static Ecore_Timer *quit_timer = NULL; 22static Ecore_Timer *quit_timer = NULL;
22 23
23static Eina_Bool 24static Eina_Bool
@@ -28,6 +29,15 @@ _cb_quit_timer(void *data EINA_UNUSED)
28 return EINA_FALSE; 29 return EINA_FALSE;
29} 30}
30 31
32static Eina_Bool
33_cb_quit_timer_start(void *data EINA_UNUSED)
34{
35 quit_timer_start = NULL;
36 if (quit_timer) ecore_timer_del(quit_timer);
37 quit_timer = ecore_timer_add(10.0, _cb_quit_timer, NULL);
38 return EINA_FALSE;
39}
40
31static void 41static void
32_broadcast(Ecore_Ipc_Server *svr, int major, int minor, void *data, int size) 42_broadcast(Ecore_Ipc_Server *svr, int major, int minor, void *data, int size)
33{ 43{
@@ -101,6 +111,11 @@ _cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
101 ecore_timer_del(quit_timer); 111 ecore_timer_del(quit_timer);
102 quit_timer = NULL; 112 quit_timer = NULL;
103 } 113 }
114 if (quit_timer_start)
115 {
116 ecore_timer_del(quit_timer_start);
117 quit_timer_start = NULL;
118 }
104 clients++; 119 clients++;
105 return ECORE_CALLBACK_DONE; 120 return ECORE_CALLBACK_DONE;
106} 121}
@@ -211,7 +226,7 @@ ipc_init(void)
211 ecore_ipc_shutdown(); 226 ecore_ipc_shutdown();
212 return EINA_FALSE; 227 return EINA_FALSE;
213 } 228 }
214 quit_timer = ecore_timer_add(2.0, _cb_quit_timer, NULL); 229 quit_timer_start = ecore_timer_add(10.0, _cb_quit_timer_start, NULL);
215 hnd_add = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, 230 hnd_add = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD,
216 _cb_client_add, NULL); 231 _cb_client_add, NULL);
217 hnd_del = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, 232 hnd_del = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL,
@@ -228,6 +243,10 @@ ipc_shutdown(void)
228 if (init <= 0) return EINA_TRUE; 243 if (init <= 0) return EINA_TRUE;
229 init--; 244 init--;
230 if (init > 0) return EINA_TRUE; 245 if (init > 0) return EINA_TRUE;
246 if (quit_timer) ecore_timer_del(quit_timer);
247 if (quit_timer_start) ecore_timer_del(quit_timer_start);
248 quit_timer = NULL;
249 quit_timer_start = NULL;
231 ecore_ipc_server_del(ipc); 250 ecore_ipc_server_del(ipc);
232 ecore_event_handler_del(hnd_add); 251 ecore_event_handler_del(hnd_add);
233 ecore_event_handler_del(hnd_del); 252 ecore_event_handler_del(hnd_del);
diff --git a/src/lib/efreet/efreet_cache.c b/src/lib/efreet/efreet_cache.c
index 883cf5e3c2..329bcc7ebc 100644
--- a/src/lib/efreet/efreet_cache.c
+++ b/src/lib/efreet/efreet_cache.c
@@ -117,7 +117,7 @@ _ipc_launch(void)
117 char buf[PATH_MAX]; 117 char buf[PATH_MAX];
118 int num; 118 int num;
119 int try_gap = 10000; // 10ms 119 int try_gap = 10000; // 10ms
120 int tries = 200; // 200 * 10ms == 2sec 120 int tries = 1000; // 1000 * 10ms == 10sec
121 const char *s; 121 const char *s;
122 122
123 s = getenv("EFREETD_CONNECT_TRIES"); 123 s = getenv("EFREETD_CONNECT_TRIES");
diff --git a/src/lib/eina/eina_inline_str.x b/src/lib/eina/eina_inline_str.x
index 1ca5093ba2..96de70336a 100644
--- a/src/lib/eina/eina_inline_str.x
+++ b/src/lib/eina/eina_inline_str.x
@@ -96,13 +96,19 @@ eina_strndup(const char *str, size_t n)
96{ 96{
97 char *ret; 97 char *ret;
98 const char *p; 98 const char *p;
99 size_t slen; 99 size_t slen = 0;
100 100
101 if (!str) 101 if (!str)
102 return NULL; 102 return NULL;
103 103 for (p = str; *p; p++)
104 for (p = str; (*p) && ((size_t)(p - str) < n); p++) 104 {
105 slen = (size_t)(p - str); 105 slen = (size_t)(p - str) + 1;
106 if (slen > n)
107 {
108 slen = n;
109 break;
110 }
111 }
106 ret = (char *)malloc(slen + 1); /* cast for C++ code */ 112 ret = (char *)malloc(slen + 1); /* cast for C++ code */
107 if (!ret) 113 if (!ret)
108 return NULL; 114 return NULL;