From 25e132881a18faed1e9438b882367df0dc4e090f Mon Sep 17 00:00:00 2001 From: Nils Durner Date: Sat, 17 Apr 2010 10:35:44 +0000 Subject: [PATCH] MinGW pipes --- src/util/disk.c | 3 ++- src/util/test_os_start_process.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/util/disk.c b/src/util/disk.c index 588ecae3c..233802569 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -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 diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c index f768e3ccf..3b34beedf 100644 --- a/src/util/test_os_start_process.c +++ b/src/util/test_os_start_process.c @@ -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; -- 2.25.1