MinGW pipes
authorNils Durner <durner@gnunet.org>
Sat, 17 Apr 2010 10:35:44 +0000 (10:35 +0000)
committerNils Durner <durner@gnunet.org>
Sat, 17 Apr 2010 10:35:44 +0000 (10:35 +0000)
src/util/disk.c
src/util/test_os_start_process.c

index 588ecae3cc5dd3b606013032f8ee06d8425cc28c..23380256945bc5d1ddd36ae610719b3421ab89c6 100644 (file)
@@ -1688,7 +1688,6 @@ GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p,
   int ret = GNUNET_OK;
   int save;
 
-  /* FIXME: What can we safely set HANDLE to once we've closed an end, NULL? */
 #ifdef MINGW
   if (end == GNUNET_DISK_PIPE_END_READ)
     {
@@ -1697,6 +1696,7 @@ GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p,
           SetErrnoFromWinError (GetLastError ());
           ret = GNUNET_SYSERR;
         }
+      p->fd[0]->h = INVALID_HANDLE_VALUE;
     }
   else if (end == GNUNET_DISK_PIPE_END_WRITE)
     {
@@ -1705,6 +1705,7 @@ GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p,
           SetErrnoFromWinError (GetLastError ());
           ret = GNUNET_SYSERR;
         }
+      p->fd[1]->h = INVALID_HANDLE_VALUE;
     }
   save = errno;
 #else
index f768e3ccff2772dfd604dc7f3721d80ebf2fb425..3b34beedf3f6fe544dc53f17370f7dc1ec44db4a 100644 (file)
@@ -102,8 +102,8 @@ static void
 task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   char *fn;
-
   const struct GNUNET_DISK_FileHandle *stdout_read_handle;
+  struct GNUNET_DISK_FileHandle *wh;
 
   GNUNET_asprintf(&fn, "cat");
 
@@ -126,8 +126,10 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   /* Close the read end of the write pipe */
   GNUNET_DISK_pipe_close_end(hello_pipe_stdin, GNUNET_DISK_PIPE_END_READ);
 
+  wh = GNUNET_DISK_pipe_handle (hello_pipe_stdin, GNUNET_DISK_PIPE_END_WRITE);
+
   /* Write the test_phrase to the cat process */
-  if (GNUNET_DISK_file_write(hello_pipe_stdin, test_phrase, strlen(test_phrase) + 1) != GNUNET_YES)
+  if (GNUNET_DISK_file_write(wh, test_phrase, strlen(test_phrase) + 1) != GNUNET_YES)
     {
       ok = 1;
       return;