aboutsummaryrefslogtreecommitdiffstats
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
parentEfl.ui.progressbar: remove duplicate call (diff)
downloadefl-e9d1a1e9884331aca633e32f2592739a224dfdb2.tar.gz
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,
DBG("_ecore_main_fd_handler_add");
Ecore_Fd_Handler *fdh = NULL;
- if ((fd < 0) || (!func)) return NULL;
+ if ((fd < 0) || (flags == 0) || (!func)) return NULL;
fdh = ecore_fd_handler_calloc(1);
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)
}
END_TEST
+START_TEST(ecore_test_ecore_main_loop_fd_handler_valid_flags)
+{
+ Ecore_Fd_Handler *fd_handler;
+ int comm[2];
+ int ret;
+
+ ret = ecore_init();
+ fail_if(ret < 1);
+
+ ret = pipe(comm);
+ fail_if(ret != 0);
+
+ fd_handler = ecore_main_fd_handler_add
+ (comm[0], 0, _fd_handler_cb, NULL, NULL, NULL);
+ fail_if(fd_handler != NULL);
+
+ if (fd_handler)
+ ecore_main_fd_handler_del(fd_handler);
+
+ close(comm[0]);
+ close(comm[1]);
+
+ ecore_shutdown();
+}
+END_TEST
+
static void
_eo_read_cb(void *data, const Efl_Event *info EINA_UNUSED)
{
@@ -897,6 +923,7 @@ void ecore_test_ecore(TCase *tc)
tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter);
tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler);
+ tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_valid_flags);
tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler_activate_modify);
tcase_add_test(tc, ecore_test_ecore_main_loop_event);
#if 0