diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-31 17:46:17 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-31 17:46:17 +0000 |
commit | 8833066b122427710a9e14a888ce6cfa862332d3 (patch) | |
tree | 29591019d695919417b3698618d6a342e97381d6 /libio | |
parent | fedca46896bdb702cb988837a0c2c5447e72ba2b (diff) |
Updated to fedora-glibc-20070731T1624cvs/fedora-glibc-2_6_90-1
Diffstat (limited to 'libio')
-rw-r--r-- | libio/fileops.c | 5 | ||||
-rw-r--r-- | libio/genops.c | 18 | ||||
-rw-r--r-- | libio/iopopen.c | 13 | ||||
-rw-r--r-- | libio/libio.h | 10 | ||||
-rw-r--r-- | libio/libioP.h | 10 |
5 files changed, 45 insertions, 11 deletions
diff --git a/libio/fileops.c b/libio/fileops.c index 886b3729c3..95cd2d64c9 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -320,6 +320,11 @@ _IO_new_file_fopen (fp, filename, mode, is32not64) case 'c': fp->_flags2 |= _IO_FLAGS2_NOTCANCEL; break; +#ifdef O_CLOEXEC + case 'e': + oflags |= O_CLOEXEC; + break; +#endif default: /* Ignore. */ continue; diff --git a/libio/genops.c b/libio/genops.c index 3f8d71a50f..7005fdbd96 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -64,23 +64,29 @@ _IO_un_link (fp) { if (fp->file._flags & _IO_LINKED) { - struct _IO_FILE_plus **f; + struct _IO_FILE **f; #ifdef _IO_MTSAFE_IO _IO_cleanup_region_start_noarg (flush_cleanup); _IO_lock_lock (list_all_lock); run_fp = (_IO_FILE *) fp; _IO_flockfile ((_IO_FILE *) fp); #endif - for (f = &INTUSE(_IO_list_all); *f; - f = (struct _IO_FILE_plus **) &(*f)->file._chain) + if (INTUSE(_IO_list_all) == NULL) + ; + else if (fp == INTUSE(_IO_list_all)) { - if (*f == fp) + INTUSE(_IO_list_all) + = (struct _IO_FILE_plus *) INTUSE(_IO_list_all)->file._chain; + ++_IO_list_all_stamp; + } + else + for (f = &INTUSE(_IO_list_all)->file._chain; *f; f = &(*f)->_chain) + if (*f == (_IO_FILE *) fp) { - *f = (struct _IO_FILE_plus *) fp->file._chain; + *f = fp->file._chain; ++_IO_list_all_stamp; break; } - } fp->file._flags &= ~_IO_LINKED; #ifdef _IO_MTSAFE_IO _IO_funlockfile ((_IO_FILE *) fp); diff --git a/libio/iopopen.c b/libio/iopopen.c index 896e930f40..d5c6305b09 100644 --- a/libio/iopopen.c +++ b/libio/iopopen.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993, 1997-2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1997-2002, 2003, 2004, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. @@ -169,7 +170,15 @@ _IO_new_proc_open (fp, command, mode) popen() calls that remain open in the parent process are closed in the new child process." */ for (p = proc_file_chain; p; p = p->next) - _IO_close (_IO_fileno ((_IO_FILE *) p)); + { + int fd = _IO_fileno ((_IO_FILE *) p); + + /* If any stream from previous popen() calls has fileno + child_std_end, it has been already closed by the dup2 syscall + above. */ + if (fd != child_std_end) + _IO_close (fd); + } _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0); _IO__exit (127); diff --git a/libio/libio.h b/libio/libio.h index 9df08614ee..a807883856 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1995,1997-2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 1991-1995,1997-2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. @@ -413,9 +413,11 @@ extern "C" { extern int __underflow (_IO_FILE *); extern int __uflow (_IO_FILE *); extern int __overflow (_IO_FILE *, int); +#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T extern _IO_wint_t __wunderflow (_IO_FILE *); extern _IO_wint_t __wuflow (_IO_FILE *); extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t); +#endif #if __GNUC__ >= 3 # define _IO_BE(expr, res) __builtin_expect ((expr), res) @@ -435,15 +437,17 @@ extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t); ? __overflow (_fp, (unsigned char) (_ch)) \ : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch))) -#define _IO_getwc_unlocked(_fp) \ +#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T +# define _IO_getwc_unlocked(_fp) \ (_IO_BE ((_fp)->_wide_data->_IO_read_ptr >= (_fp)->_wide_data->_IO_read_end,\ 0) \ ? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++) -#define _IO_putwc_unlocked(_wch, _fp) \ +# define _IO_putwc_unlocked(_wch, _fp) \ (_IO_BE ((_fp)->_wide_data->_IO_write_ptr \ >= (_fp)->_wide_data->_IO_write_end, 0) \ ? __woverflow (_fp, _wch) \ : (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch))) +#endif #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0) #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0) diff --git a/libio/libioP.h b/libio/libioP.h index a574b40f77..b99b81743f 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -968,3 +968,13 @@ _IO_acquire_lock_fct (_IO_FILE **p) if ((fp->_flags & _IO_USER_LOCK) == 0) _IO_funlockfile (fp); } + +static inline void +__attribute__ ((__always_inline__)) +_IO_acquire_lock_clear_flags2_fct (_IO_FILE **p) +{ + _IO_FILE *fp = *p; + fp->_flags &= ~_IO_FLAGS2_FORTIFY; + if ((fp->_flags & _IO_USER_LOCK) == 0) + _IO_funlockfile (fp); +} |