1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-11-03 20:53:13 +03:00

Fix a few problems in fopen and freopen

fopen should set the FD_CLOEXEC flag if requested evenif the kernel does
not support an aotmic operation.

freopen should reuse the file descriptor for the stream.  This is
especially important for calls to change the standard streams (stin,
stdout, stderr).
This commit is contained in:
Ulrich Drepper
2011-05-15 15:28:46 -04:00
parent bd25564e1e
commit 94b7cc3711
9 changed files with 143 additions and 39 deletions

View File

@@ -79,6 +79,7 @@ char *__canonicalize_directory_name_internal (__const char *__thisdir,
extern int __dup (int __fd);
extern int __dup2 (int __fd, int __fd2);
libc_hidden_proto (__dup2)
libc_hidden_proto (dup3)
extern int __execve (__const char *__path, char *__const __argv[],
char *__const __envp[]);
extern long int __pathconf (__const char *__path, int __name);
@@ -175,6 +176,7 @@ extern int __have_sock_cloexec;
SOCK_CLOEXEC. Avoid defining separate variables for all of them
unless it is really necessary. */
#define __have_pipe2 __have_sock_cloexec
#define __have_dup3 __have_sock_cloexec
extern int __getlogin_r_loginuid (char *name, size_t namesize)
attribute_hidden;