summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyoungwoon Roy, Kim <myoungwoon.kim@samsung.com>2018-01-31 18:04:09 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2018-01-31 18:55:40 +0900
commite9d1a1e9884331aca633e32f2592739a224dfdb2 (patch)
treee9807a0c6127a5d8b8238b3bc18d44ac2665cf09
parent98f38ac0f7d4e88779eebb31d0e191222c6ca41c (diff)
ecore_main: Check for the valid flag
Summary: This patch checks for the valid Ecore_Fd_Handler_Flags. The flags should be checked like previous verion because There are no default handlings in case of out of Ecore_Fd_Handler enum values in other funcs. Test Plan: Execute a test case Reviewers: cedric, raster, jpeg, stefan, Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5775
-rw-r--r--src/lib/ecore/ecore_main.c2
-rw-r--r--src/tests/ecore/ecore_test_ecore.c27
2 files changed, 28 insertions, 1 deletions
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index a1388a8aa7..214f73215e 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -1280,7 +1280,7 @@ _ecore_main_fd_handler_add(Eo *obj,
1280 DBG("_ecore_main_fd_handler_add"); 1280 DBG("_ecore_main_fd_handler_add");
1281 Ecore_Fd_Handler *fdh = NULL; 1281 Ecore_Fd_Handler *fdh = NULL;
1282 1282
1283 if ((fd < 0) || (!func)) return NULL; 1283 if ((fd < 0) || (flags == 0) || (!func)) return NULL;
1284 1284
1285 fdh = ecore_fd_handler_calloc(1); 1285 fdh = ecore_fd_handler_calloc(1);
1286 if (!fdh) return NULL; 1286 if (!fdh) return NULL;
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index 89f3c0dbef..3fd89a90b1 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -269,6 +269,32 @@ START_TEST(ecore_test_ecore_main_loop_fd_handler)
269} 269}
270END_TEST 270END_TEST
271 271
272START_TEST(ecore_test_ecore_main_loop_fd_handler_valid_flags)
273{
274 Ecore_Fd_Handler *fd_handler;
275 int comm[2];
276 int ret;
277
278 ret = ecore_init();
279 fail_if(ret < 1);
280
281 ret = pipe(comm);
282 fail_if(ret != 0);
283
284 fd_handler = ecore_main_fd_handler_add
285 (comm[0], 0, _fd_handler_cb, NULL, NULL, NULL);
286 fail_if(fd_handler != NULL);
287
288 if (fd_handler)
289 ecore_main_fd_handler_del(fd_handler);
290
291 close(comm[0]);
292 close(comm[1]);
293
294 ecore_shutdown();
295}
296END_TEST
297
272static void 298static void
273_eo_read_cb(void *data, const Efl_Event *info EINA_UNUSED) 299_eo_read_cb(void *data, const Efl_Event *info EINA_UNUSED)
274{ 300{
@@ -897,6 +923,7 @@ void ecore_test_ecore(TCase *tc)
897 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter); 923 tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
898 tcase_add_test(tc, ecore_test_ecore_main_loop_timer); 924 tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
899 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler); 925 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler);
926 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_valid_flags);
900 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_activate_modify); 927 tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_activate_modify);
901 tcase_add_test(tc, ecore_test_ecore_main_loop_event); 928 tcase_add_test(tc, ecore_test_ecore_main_loop_event);
902#if 0 929#if 0