Enlightenment CVS committal
Author : onefang
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore
Modified Files:
ecore_exe.c
Log Message:
Be paranoid, don't rely on dup2 to close for us. As a bonus, we get error
messages if there's a problem closing them.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore_exe.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- ecore_exe.c 3 Feb 2006 23:01:02 -0000 1.52
+++ ecore_exe.c 7 Feb 2006 06:05:58 -0000 1.53
@@ -304,9 +304,22 @@
else if (pid == 0) /* child */
{
/* dup2 STDERR, STDIN, and STDOUT. dup2() allegedly closes the
second pipe if it's open. */
- if (ok && (flags & ECORE_EXE_PIPE_ERROR)) E_NO_ERRNO(result,
dup2(errorPipe[1], STDERR_FILENO), ok);
- if (ok && (flags & ECORE_EXE_PIPE_READ)) E_NO_ERRNO(result,
dup2(readPipe[1], STDOUT_FILENO), ok);
- if (ok && (flags & ECORE_EXE_PIPE_WRITE)) E_NO_ERRNO(result,
dup2(writePipe[0], STDIN_FILENO), ok);
+ /* On the other hand, there was the Great FD Leak Scare of '06,
so let's be paranoid. */
+ if (ok && (flags & ECORE_EXE_PIPE_ERROR))
+ {
+ E_NO_ERRNO(result, close(STDERR_FILENO), ok);
+ E_NO_ERRNO(result, dup2(errorPipe[1], STDERR_FILENO), ok);
+ }
+ if (ok && (flags & ECORE_EXE_PIPE_READ))
+ {
+ E_NO_ERRNO(result, close(STDOUT_FILENO), ok);
+ E_NO_ERRNO(result, dup2(readPipe[1], STDOUT_FILENO), ok);
+ }
+ if (ok && (flags & ECORE_EXE_PIPE_WRITE))
+ {
+ E_NO_ERRNO(result, close(STDIN_FILENO), ok);
+ E_NO_ERRNO(result, dup2(writePipe[0], STDIN_FILENO), ok);
+ }
if (ok)
{
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs