aboutsummaryrefslogtreecommitdiff
path: root/libiberty/pex-win32.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2006-04-12 18:42:01 +0000
committerDJ Delorie <dj@redhat.com>2006-04-12 18:42:01 +0000
commit3db2e6ddf680eecc3060ba5a12d4c97072389d90 (patch)
treeab8a75ac527440e6f89d20b23afc619aa09d188c /libiberty/pex-win32.c
parent01d3a6ce134b69233591c6ad34ecdf844142e2c4 (diff)
downloadgdb-3db2e6ddf680eecc3060ba5a12d4c97072389d90.zip
gdb-3db2e6ddf680eecc3060ba5a12d4c97072389d90.tar.gz
gdb-3db2e6ddf680eecc3060ba5a12d4c97072389d90.tar.bz2
merge from gcc
Diffstat (limited to 'libiberty/pex-win32.c')
-rw-r--r--libiberty/pex-win32.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c
index 3a75c5b..046f393 100644
--- a/libiberty/pex-win32.c
+++ b/libiberty/pex-win32.c
@@ -83,6 +83,7 @@ static int pex_win32_wait (struct pex_obj *, long, int *,
struct pex_time *, int, const char **, int *);
static int pex_win32_pipe (struct pex_obj *, int *, int);
static FILE *pex_win32_fdopenr (struct pex_obj *, int, int);
+static FILE *pex_win32_fdopenw (struct pex_obj *, int, int);
/* The list of functions we pass to the common routines. */
@@ -95,6 +96,7 @@ const struct pex_funcs funcs =
pex_win32_wait,
pex_win32_pipe,
pex_win32_fdopenr,
+ pex_win32_fdopenw,
NULL /* cleanup */
};
@@ -766,6 +768,18 @@ pex_win32_fdopenr (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd,
return fdopen (fd, binary ? "rb" : "r");
}
+static FILE *
+pex_win32_fdopenw (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd,
+ int binary)
+{
+ HANDLE h = (HANDLE) _get_osfhandle (fd);
+ if (h == INVALID_HANDLE_VALUE)
+ return NULL;
+ if (! SetHandleInformation (h, HANDLE_FLAG_INHERIT, 0))
+ return NULL;
+ return fdopen (fd, binary ? "wb" : "w");
+}
+
#ifdef MAIN
#include <stdio.h>