projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename 'arch' by 'gdbarch' in m32c_gdbarch_init
[deliverable/binutils-gdb.git]
/
libiberty
/
pex-unix.c
diff --git
a/libiberty/pex-unix.c
b/libiberty/pex-unix.c
index c4a69ad07c09388563a6e0dea3f49af967ad62c4..b48f315f83fa9b744426bd3f89acfce0f72e861a 100644
(file)
--- a/
libiberty/pex-unix.c
+++ b/
libiberty/pex-unix.c
@@
-1,8
+1,8
@@
/* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Generic Unix version
(also used for UWIN and VMS).
/* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Generic Unix version
(also used for UWIN and VMS).
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2009
- Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2009
,
+
2010, 2015
Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
@@
-23,6
+23,7
@@
Boston, MA 02110-1301, USA. */
#include "config.h"
#include "libiberty.h"
#include "pex-common.h"
#include "config.h"
#include "libiberty.h"
#include "pex-common.h"
+#include "environ.h"
#include <stdio.h>
#include <signal.h>
#include <stdio.h>
#include <signal.h>
@@
-85,13
+86,15
@@
to_ptr32 (char **ptr64)
int argc;
__char_ptr_char_ptr32 short_argv;
int argc;
__char_ptr_char_ptr32 short_argv;
- for (argc=0; ptr64[argc]; argc++);
+ /* Count number of arguments. */
+ for (argc = 0; ptr64[argc] != NULL; argc++)
+ ;
/* Reallocate argv with 32 bit pointers. */
short_argv = (__char_ptr_char_ptr32) decc$malloc
(sizeof (__char_ptr32) * (argc + 1));
/* Reallocate argv with 32 bit pointers. */
short_argv = (__char_ptr_char_ptr32) decc$malloc
(sizeof (__char_ptr32) * (argc + 1));
- for (argc
=0; ptr64[argc]
; argc++)
+ for (argc
= 0; ptr64[argc] != NULL
; argc++)
short_argv[argc] = (__char_ptr32) decc$strdup (ptr64[argc]);
short_argv[argc] = (__char_ptr32) 0;
short_argv[argc] = (__char_ptr32) decc$strdup (ptr64[argc]);
short_argv[argc] = (__char_ptr32) 0;
@@
-299,7
+302,7
@@
pex_wait (struct pex_obj *obj, pid_t pid, int *status, struct pex_time *time)
static void pex_child_error (struct pex_obj *, const char *, const char *, int)
ATTRIBUTE_NORETURN;
static int pex_unix_open_read (struct pex_obj *, const char *, int);
static void pex_child_error (struct pex_obj *, const char *, const char *, int)
ATTRIBUTE_NORETURN;
static int pex_unix_open_read (struct pex_obj *, const char *, int);
-static int pex_unix_open_write (struct pex_obj *, const char *, int);
+static int pex_unix_open_write (struct pex_obj *, const char *, int
, int
);
static pid_t pex_unix_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
static pid_t pex_unix_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
@@
-348,11
+351,12
@@
pex_unix_open_read (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
static int
pex_unix_open_write (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
static int
pex_unix_open_write (struct pex_obj *obj ATTRIBUTE_UNUSED, const char *name,
- int binary ATTRIBUTE_UNUSED)
+ int binary ATTRIBUTE_UNUSED
, int append
)
{
/* Note that we can't use O_EXCL here because gcc may have already
created the temporary file via make_temp_file. */
{
/* Note that we can't use O_EXCL here because gcc may have already
created the temporary file via make_temp_file. */
- return open (name, O_WRONLY | O_CREAT | O_TRUNC, PUBLIC_MODE);
+ return open (name, O_WRONLY | O_CREAT
+ | (append ? O_APPEND : O_TRUNC), PUBLIC_MODE);
}
/* Close a file. */
}
/* Close a file. */
@@
-387,8
+391,6
@@
pex_child_error (struct pex_obj *obj, const char *executable,
/* Execute a child. */
/* Execute a child. */
-extern char **environ;
-
#if defined(HAVE_SPAWNVE) && defined(HAVE_SPAWNVPE)
/* Implementation of pex->exec_child using the Cygwin spawn operation. */
#if defined(HAVE_SPAWNVE) && defined(HAVE_SPAWNVPE)
/* Implementation of pex->exec_child using the Cygwin spawn operation. */
This page took
0.028332 seconds
and
4
git commands to generate.