comparison libiberty/pex-djgpp.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents 77e2b8dfacca
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Utilities to execute a program in a subprocess (possibly linked by pipes 1 /* Utilities to execute a program in a subprocess (possibly linked by pipes
2 with other subprocesses), and wait for it. DJGPP specialization. 2 with other subprocesses), and wait for it. DJGPP specialization.
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005 3 Copyright (C) 1996-2017 Free Software Foundation, Inc.
4 Free Software Foundation, Inc.
5 4
6 This file is part of the libiberty library. 5 This file is part of the libiberty library.
7 Libiberty is free software; you can redistribute it and/or 6 Libiberty is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
41 #else 40 #else
42 #define PWAIT_ERROR EINVAL 41 #define PWAIT_ERROR EINVAL
43 #endif 42 #endif
44 43
45 static int pex_djgpp_open_read (struct pex_obj *, const char *, int); 44 static int pex_djgpp_open_read (struct pex_obj *, const char *, int);
46 static int pex_djgpp_open_write (struct pex_obj *, const char *, int); 45 static int pex_djgpp_open_write (struct pex_obj *, const char *, int, int);
47 static pid_t pex_djgpp_exec_child (struct pex_obj *, int, const char *, 46 static pid_t pex_djgpp_exec_child (struct pex_obj *, int, const char *,
48 char * const *, char * const *, 47 char * const *, char * const *,
49 int, int, int, int, 48 int, int, int, int,
50 const char **, int *); 49 const char **, int *);
51 static int pex_djgpp_close (struct pex_obj *, int); 50 static int pex_djgpp_close (struct pex_obj *, int);
88 87
89 /* Open a file for writing. */ 88 /* Open a file for writing. */
90 89
91 static int 90 static int
92 pex_djgpp_open_write (struct pex_obj *obj ATTRIBUTE_UNUSED, 91 pex_djgpp_open_write (struct pex_obj *obj ATTRIBUTE_UNUSED,
93 const char *name, int binary) 92 const char *name, int binary, int append)
94 { 93 {
95 /* Note that we can't use O_EXCL here because gcc may have already 94 /* Note that we can't use O_EXCL here because gcc may have already
96 created the temporary file via make_temp_file. */ 95 created the temporary file via make_temp_file. */
96 if (append)
97 return -1;
97 return open (name, 98 return open (name,
98 (O_WRONLY | O_CREAT | O_TRUNC 99 (O_WRONLY | O_CREAT | O_TRUNC
99 | (binary ? O_BINARY : O_TEXT)), 100 | (binary ? O_BINARY : O_TEXT)),
100 S_IRUSR | S_IWUSR); 101 S_IRUSR | S_IWUSR);
101 } 102 }