aboutsummaryrefslogtreecommitdiff
path: root/libiberty/pex-unix.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-unix.c
parent01d3a6ce134b69233591c6ad34ecdf844142e2c4 (diff)
downloadgdb-3db2e6ddf680eecc3060ba5a12d4c97072389d90.zip
gdb-3db2e6ddf680eecc3060ba5a12d4c97072389d90.tar.gz
gdb-3db2e6ddf680eecc3060ba5a12d4c97072389d90.tar.bz2
merge from gcc
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)
{