Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore


Modified Files:
        ecore_exe.c ecore_private.h 


Log Message:
I thought the child exe was responsible for closing it's own end of the 
pipe, guess I was wrong.  Thanks to raster for continueing to pester me.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore_exe.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- ecore_exe.c 7 Feb 2006 06:05:58 -0000       1.53
+++ ecore_exe.c 14 Feb 2006 12:54:25 -0000      1.54
@@ -274,18 +274,30 @@
    if ( (flags & ECORE_EXE_PIPE_AUTO) && (! (flags & ECORE_EXE_PIPE_ERROR)) && 
(! (flags & ECORE_EXE_PIPE_READ)) )
       flags |= ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR;   /* We need 
something to auto pipe. */
 
+   exe->child_fd_error = -1;
+   exe->child_fd_read = -1;
+   exe->child_fd_write = -1;
    /*  Create some pipes. */
    if (ok)   E_IF_NO_ERRNO_NOLOOP(result, pipe(statusPipe), ok)
         ;
    if (ok && (flags & ECORE_EXE_PIPE_ERROR))
       E_IF_NO_ERRNO_NOLOOP(result, pipe(errorPipe), ok)
-         exe->child_fd_error = errorPipe[0];
+         {
+            exe->child_fd_error = errorPipe[0];
+            exe->child_fd_error_x = errorPipe[1];
+        }
    if (ok && (flags & ECORE_EXE_PIPE_READ))
       E_IF_NO_ERRNO_NOLOOP(result, pipe(readPipe),  ok)
-         exe->child_fd_read = readPipe[0];
+         {
+            exe->child_fd_read = readPipe[0];
+            exe->child_fd_read_x = readPipe[1];
+        }
    if (ok && (flags & ECORE_EXE_PIPE_WRITE))
       E_IF_NO_ERRNO_NOLOOP(result, pipe(writePipe), ok)
-         exe->child_fd_write = writePipe[1];
+         {
+            exe->child_fd_write = writePipe[1];
+            exe->child_fd_write_x = writePipe[0];
+        }
 
    if (ok)
       {
@@ -773,9 +785,12 @@
    IF_FN_DEL(ecore_main_fd_handler_del, exe->write_fd_handler);
    IF_FN_DEL(ecore_main_fd_handler_del, exe->read_fd_handler);
    IF_FN_DEL(ecore_main_fd_handler_del, exe->error_fd_handler);
-   if (exe->child_fd_write)  E_NO_ERRNO(result, close(exe->child_fd_write), 
ok);
-   if (exe->child_fd_read)   E_NO_ERRNO(result, close(exe->child_fd_read), ok);
-   if (exe->child_fd_error)  E_NO_ERRNO(result, close(exe->child_fd_error), 
ok);
+   if (exe->child_fd_write_x != -1)  E_NO_ERRNO(result, 
close(exe->child_fd_write_x), ok);
+   if (exe->child_fd_read_x != -1)   E_NO_ERRNO(result, 
close(exe->child_fd_read_x), ok);
+   if (exe->child_fd_error_x != -1)  E_NO_ERRNO(result, 
close(exe->child_fd_error_x), ok);
+   if (exe->child_fd_write != -1)    E_NO_ERRNO(result, 
close(exe->child_fd_write), ok);
+   if (exe->child_fd_read != -1)     E_NO_ERRNO(result, 
close(exe->child_fd_read), ok);
+   if (exe->child_fd_error != -1)    E_NO_ERRNO(result, 
close(exe->child_fd_error), ok);
    IF_FREE(exe->write_data_buf);
    IF_FREE(exe->read_data_buf);
    IF_FREE(exe->error_data_buf);
@@ -1346,10 +1361,10 @@
          int result;
 
 printf("Closing stdin for %s\n", exe->cmd);
-         /* if (exe->child_fd_write)  E_NO_ERRNO(result, 
fsync(exe->child_fd_write), ok);   This a) doesn't work, and b) isn't needed. */
+         /* if (exe->child_fd_write != -1)  E_NO_ERRNO(result, 
fsync(exe->child_fd_write), ok);   This a) doesn't work, and b) isn't needed. */
          IF_FN_DEL(ecore_main_fd_handler_del, exe->write_fd_handler);
-         if (exe->child_fd_write)  E_NO_ERRNO(result, 
close(exe->child_fd_write), ok);
-        exe->child_fd_write = 0;
+         if (exe->child_fd_write != -1)  E_NO_ERRNO(result, 
close(exe->child_fd_write), ok);
+        exe->child_fd_write = -1;
          IF_FREE(exe->write_data_buf);
       }
 
@@ -1362,7 +1377,7 @@
    int count;
 
    /* check whether we need to write anything at all. */
-   if ((!exe->child_fd_write) && (!exe->write_data_buf))   return;
+   if ((!exe->child_fd_write != -1) && (!exe->write_data_buf))   return;
    if (exe->write_data_size == exe->write_data_offset)     return;
 
    count = write(exe->child_fd_write, 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore_private.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- ecore_private.h     17 Jan 2006 11:33:39 -0000      1.39
+++ ecore_private.h     14 Feb 2006 12:54:26 -0000      1.40
@@ -259,6 +259,9 @@
    int          child_fd_write;        /* fd to write TO to send data to the 
child */
    int          child_fd_read; /* fd to read FROM when child has sent us (the 
parent) data */
    int          child_fd_error;        /* fd to read FROM when child has sent 
us (the parent) errors */
+   int          child_fd_write_x;      /* fd to write TO to send data to the 
child */
+   int          child_fd_read_x;       /* fd to read FROM when child has sent 
us (the parent) data */
+   int          child_fd_error_x;      /* fd to read FROM when child has sent 
us (the parent) errors */
    int          close_stdin;
 
    int start_bytes, end_bytes, start_lines, end_lines; /* Number of 
bytes/lines to auto pipe at start/end of stdout/stderr. */




-------------------------------------------------------
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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to