summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-09-19 23:59:59 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-09-20 00:20:42 +0100
commitca4b9393644f142cbe26cab6734f81f6d891b535 (patch)
treec8a69f8e7bf6415512122ef49caa779bbbd98667 /src/lib
parent568dd7e45ba05eca7c3be58d1f778daf3c565d6b (diff)
ecore - efl exe - check returns of open and dup2 for stdin etc. fds
check returns - fix CID 1397002
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore/efl_exe.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/ecore/efl_exe.c b/src/lib/ecore/efl_exe.c
index 03c52ab845..7239bcdf6f 100644
--- a/src/lib/ecore/efl_exe.c
+++ b/src/lib/ecore/efl_exe.c
@@ -537,13 +537,14 @@ _efl_exe_efl_task_run(Eo *obj, Efl_Exe_Data *pd)
537 { 537 {
538 // hide stdin 538 // hide stdin
539 devnull = open("/dev/null", O_RDONLY); 539 devnull = open("/dev/null", O_RDONLY);
540 dup2(devnull, STDIN_FILENO); 540 if (devnull < 0) _exit(1);
541 if (dup2(devnull, STDIN_FILENO) < 0) _exit(1);
541 close(devnull); 542 close(devnull);
542 } 543 }
543 else if ((td->flags & EFL_TASK_FLAGS_USE_STDIN)) 544 else if ((td->flags & EFL_TASK_FLAGS_USE_STDIN))
544 { 545 {
545 // hook up stdin to the pipe going to the parent 546 // hook up stdin to the pipe going to the parent
546 dup2(pipe_stdin[0], STDIN_FILENO); 547 if (dup2(pipe_stdin[0], STDIN_FILENO) < 0) _exit(1);
547 close(pipe_stdin[0]); 548 close(pipe_stdin[0]);
548 } 549 }
549 550
@@ -552,13 +553,14 @@ _efl_exe_efl_task_run(Eo *obj, Efl_Exe_Data *pd)
552 { 553 {
553 // hide stdout 554 // hide stdout
554 devnull = open("/dev/null", O_WRONLY); 555 devnull = open("/dev/null", O_WRONLY);
555 dup2(devnull, STDOUT_FILENO); 556 if (devnull < 0) _exit(1);
557 if (dup2(devnull, STDOUT_FILENO) < 0) _exit(1);
556 close(devnull); 558 close(devnull);
557 } 559 }
558 else if ((td->flags & EFL_TASK_FLAGS_USE_STDOUT)) 560 else if ((td->flags & EFL_TASK_FLAGS_USE_STDOUT))
559 { 561 {
560 // hook up stdout to the pipe going to the parent 562 // hook up stdout to the pipe going to the parent
561 dup2(pipe_stdout[1], STDOUT_FILENO); 563 if (dup2(pipe_stdout[1], STDOUT_FILENO) < 0) _exit(1);
562 close(pipe_stdout[1]); 564 close(pipe_stdout[1]);
563 } 565 }
564 566
@@ -566,7 +568,8 @@ _efl_exe_efl_task_run(Eo *obj, Efl_Exe_Data *pd)
566 { 568 {
567 // hide stderr 569 // hide stderr
568 devnull = open("/dev/null", O_WRONLY); 570 devnull = open("/dev/null", O_WRONLY);
569 dup2(devnull, STDERR_FILENO); 571 if (devnull < 0) _exit(1);
572 if (dup2(devnull, STDERR_FILENO) < 0) _exit(1);
570 close(devnull); 573 close(devnull);
571 } 574 }
572 575