jaehyun pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=58c9f5688530fc109b649b54fecfc802ded04522

commit 58c9f5688530fc109b649b54fecfc802ded04522
Author: Hosang Kim <hosang12....@samsung.com>
Date:   Tue Jan 29 19:30:45 2019 +0900

    ecore: check fcntl return.
    
    Summary: Found by svace
    
    Reviewers: Jaehyun_Cho, woohyun, Hermet
    
    Reviewed By: Jaehyun_Cho
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D7808
---
 src/lib/ecore/ecore_signal.c |  4 +++-
 src/lib/ecore/efl_thread.c   | 24 ++++++++++++++++--------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/lib/ecore/ecore_signal.c b/src/lib/ecore/ecore_signal.c
index f970842d31..1138c7be53 100644
--- a/src/lib/ecore/ecore_signal.c
+++ b/src/lib/ecore/ecore_signal.c
@@ -247,7 +247,9 @@ _ecore_signal_pipe_init(void)
           }
         eina_file_close_on_exec(sig_pipe[0], EINA_TRUE);
         eina_file_close_on_exec(sig_pipe[1], EINA_TRUE);
-        fcntl(sig_pipe[0], F_SETFL, O_NONBLOCK);
+        if (fcntl(sig_pipe[0], F_SETFL, O_NONBLOCK) < 0)
+          ERR("can't set pipe to NONBLOCK");
+
      }
    _signalhandler_setup();
    if (!sig_pipe_handler)
diff --git a/src/lib/ecore/efl_thread.c b/src/lib/ecore/efl_thread.c
index 8e4cd978fb..4d48296093 100644
--- a/src/lib/ecore/efl_thread.c
+++ b/src/lib/ecore/efl_thread.c
@@ -618,8 +618,10 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
         pd->fd.out    = pipe_from_thread[0]; // read - output from child
         eina_file_close_on_exec(thdat->fd.in, EINA_TRUE);
         eina_file_close_on_exec(pd->fd.out, EINA_TRUE);
-        fcntl(thdat->fd.in, F_SETFL, O_NONBLOCK);
-        fcntl(pd->fd.out, F_SETFL, O_NONBLOCK);
+        if (fcntl(thdat->fd.in, F_SETFL, O_NONBLOCK) < 0)
+          ERR("can't set pipe to NONBLOCK");
+        if (fcntl(pd->fd.out, F_SETFL, O_NONBLOCK) < 0)
+          ERR("can't set pipe to NONBLOCK");
         pd->fd.out_handler =
           efl_add(EFL_LOOP_HANDLER_CLASS, obj,
                   efl_loop_handler_fd_set(efl_added, pd->fd.out),
@@ -634,8 +636,10 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
         thdat->fd.out = pipe_to_thread  [0]; // read - output from parent
         eina_file_close_on_exec(pd->fd.in, EINA_TRUE);
         eina_file_close_on_exec(thdat->fd.out, EINA_TRUE);
-        fcntl(thdat->fd.out, F_SETFL, O_NONBLOCK);
-        fcntl(pd->fd.in, F_SETFL, O_NONBLOCK);
+        if (fcntl(thdat->fd.out, F_SETFL, O_NONBLOCK) < 0)
+          ERR("can't set pipe to NONBLOCK");
+        if (fcntl(pd->fd.in, F_SETFL, O_NONBLOCK) < 0)
+          ERR("can't set pipe to NONBLOCK");
         pd->fd.in_handler =
           efl_add(EFL_LOOP_HANDLER_CLASS, obj,
                   efl_loop_handler_fd_set(efl_added, pd->fd.in),
@@ -682,10 +686,14 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
    thdat->ctrl.out = pipe_to_thread  [0]; // read - output from parent
    pd->ctrl.in     = pipe_to_thread  [1]; // write - input to child
    pd->ctrl.out    = pipe_from_thread[0]; // read - output from child
-   fcntl(thdat->ctrl.in, F_SETFL, O_NONBLOCK);
-   fcntl(thdat->ctrl.out, F_SETFL, O_NONBLOCK);
-   fcntl(pd->ctrl.in, F_SETFL, O_NONBLOCK);
-   fcntl(pd->ctrl.out, F_SETFL, O_NONBLOCK);
+   if (fcntl(thdat->ctrl.in, F_SETFL, O_NONBLOCK) < 0)
+     ERR("can't set pipe to NONBLOCK");
+   if (fcntl(thdat->ctrl.out, F_SETFL, O_NONBLOCK) < 0)
+     ERR("can't set pipe to NONBLOCK");
+   if (fcntl(pd->ctrl.in, F_SETFL, O_NONBLOCK) < 0)
+     ERR("can't set pipe to NONBLOCK");
+   if (fcntl(pd->ctrl.out, F_SETFL, O_NONBLOCK) < 0)
+     ERR("can't set pipe to NONBLOCK");
    eina_file_close_on_exec(pd->ctrl.in, EINA_TRUE);
    eina_file_close_on_exec(pd->ctrl.out, EINA_TRUE);
    eina_file_close_on_exec(thdat->ctrl.in, EINA_TRUE);

-- 


Reply via email to