aboutsummaryrefslogtreecommitdiff
path: root/libiberty/pex-unix.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2006-04-12 06:29:21 +0000
committerJim Blandy <jimb@gcc.gnu.org>2006-04-12 06:29:21 +0000
commit8eff378c612e592a3cc9e161e382c57e105be6f5 (patch)
treeb7274305f47ba26e60fed695161a3513d463cd52 /libiberty/pex-unix.c
parent5ea49f9c39ed79fe33bb8c33518a3792b991104f (diff)
downloadgcc-8eff378c612e592a3cc9e161e382c57e105be6f5.zip
gcc-8eff378c612e592a3cc9e161e382c57e105be6f5.tar.gz
gcc-8eff378c612e592a3cc9e161e382c57e105be6f5.tar.bz2
pex-common.c (pex_input_file, [...]): New functions.
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. From-SVN: r112883
Diffstat (limited to 'libiberty/pex-unix.c')
-rw-r--r--libiberty/pex-unix.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c
index 35a545c..c92a429 100644
--- a/libiberty/pex-unix.c
+++ b/libiberty/pex-unix.c
@@ -277,6 +277,7 @@ static int pex_unix_wait (struct pex_obj *, long, int *, struct pex_time *,
int, const char **, int *);
static int pex_unix_pipe (struct pex_obj *, int *, int);
static FILE *pex_unix_fdopenr (struct pex_obj *, int, int);
+static FILE *pex_unix_fdopenw (struct pex_obj *, int, int);
static void pex_unix_cleanup (struct pex_obj *);
/* The list of functions we pass to the common routines. */
@@ -290,6 +291,7 @@ const struct pex_funcs funcs =
pex_unix_wait,
pex_unix_pipe,
pex_unix_fdopenr,
+ pex_unix_fdopenw,
pex_unix_cleanup
};
@@ -495,6 +497,15 @@ pex_unix_fdopenr (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd,
return fdopen (fd, "r");
}
+static FILE *
+pex_unix_fdopenw (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd,
+ int binary ATTRIBUTE_UNUSED)
+{
+ if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
+ return NULL;
+ return fdopen (fd, "w");
+}
+
static void
pex_unix_cleanup (struct pex_obj *obj ATTRIBUTE_UNUSED)
{