summaryrefslogtreecommitdiffstats
path: root/libiberty/pex-win32.c
diff options
context:
space:
mode:
authorjimb <jimb@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-12 06:29:21 +0000
committerjimb <jimb@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-12 06:29:21 +0000
commitd7e51a3571fc67e974c8c90403d24808b8cf3f8c (patch)
treeb7274305f47ba26e60fed695161a3513d463cd52 /libiberty/pex-win32.c
parent9d353bf21a5095f930d3ee1248c09b67f521fb25 (diff)
downloadppe42-gcc-d7e51a3571fc67e974c8c90403d24808b8cf3f8c.tar.gz
ppe42-gcc-d7e51a3571fc67e974c8c90403d24808b8cf3f8c.zip
src/libiberty/ChangeLog:
2006-03-29 Jim Blandy <jimb@codesourcery.com> * pex-common.c (pex_input_file, pex_input_pipe): New functions. (pex_init_common): Initialize obj->input_file. (pex_run): Close any file opened by pex_input_file. * pexecute.txh (pex_input_file, pex_input_pipe): New docs. * pex-common.h (struct pex_obj): New field input_file. (struct pex_funcs): New function ptr fdopenw. * pex-unix.c (pex_unix_fdopenw): New function. (funcs): List it as our fdopenw function. * pex-win32.c (pex_win32_fdopenw): New function. (funcs): List it as our fdopenw function. * pex-djgpp.c (funcs): Leave fdopenw null. * pex-msdos (funcs): Same. * functions.texi: Regenerated. src/include/ChangeLog: 2006-04-10 Jim Blandy <jimb@codesourcery.com> * libiberty.h (pex_input_file, pex_input_pipe): New declarations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112883 138bc75d-0d04-0410-961f-82ee72b054a4
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 3a75c5be004..046f393c6d9 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>
OpenPOWER on IntegriCloud