mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Minor cleanups in libio/iofdopen.c
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2015-03-23 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
|
* libio/iofdopen.c: Move FD_FLAGS declaration into its first use,
|
||||||
|
inside [F_GETFL]. Remove POSIX_MODE local variable, just test the
|
||||||
|
_IO_IS_APPENDING bit in READ_WRITE instead.
|
||||||
|
|
||||||
2015-03-23 Florian Weimer <fweimer@redhat.com>
|
2015-03-23 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/pthread_setaffinity.c
|
* sysdeps/unix/sysv/linux/pthread_setaffinity.c
|
||||||
|
@ -46,7 +46,6 @@ _IO_new_fdopen (fd, mode)
|
|||||||
const char *mode;
|
const char *mode;
|
||||||
{
|
{
|
||||||
int read_write;
|
int read_write;
|
||||||
int posix_mode = 0;
|
|
||||||
struct locked_FILE
|
struct locked_FILE
|
||||||
{
|
{
|
||||||
struct _IO_FILE_plus fp;
|
struct _IO_FILE_plus fp;
|
||||||
@ -55,7 +54,6 @@ _IO_new_fdopen (fd, mode)
|
|||||||
#endif
|
#endif
|
||||||
struct _IO_wide_data wd;
|
struct _IO_wide_data wd;
|
||||||
} *new_f;
|
} *new_f;
|
||||||
int fd_flags;
|
|
||||||
int i;
|
int i;
|
||||||
int use_mmap = 0;
|
int use_mmap = 0;
|
||||||
|
|
||||||
@ -73,7 +71,6 @@ _IO_new_fdopen (fd, mode)
|
|||||||
read_write = _IO_NO_READS;
|
read_write = _IO_NO_READS;
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
posix_mode = O_APPEND;
|
|
||||||
read_write = _IO_NO_READS|_IO_IS_APPENDING;
|
read_write = _IO_NO_READS|_IO_IS_APPENDING;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -101,7 +98,7 @@ _IO_new_fdopen (fd, mode)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef F_GETFL
|
#ifdef F_GETFL
|
||||||
fd_flags = _IO_fcntl (fd, F_GETFL);
|
int fd_flags = _IO_fcntl (fd, F_GETFL);
|
||||||
#ifndef O_ACCMODE
|
#ifndef O_ACCMODE
|
||||||
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
|
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
|
||||||
#endif
|
#endif
|
||||||
@ -120,9 +117,9 @@ _IO_new_fdopen (fd, mode)
|
|||||||
Realtime Extensions], Rationale B.8.3.3
|
Realtime Extensions], Rationale B.8.3.3
|
||||||
Open a Stream on a File Descriptor says:
|
Open a Stream on a File Descriptor says:
|
||||||
|
|
||||||
Although not explicitly required by POSIX.1, a good
|
Although not explicitly required by POSIX.1, a good
|
||||||
implementation of append ("a") mode would cause the
|
implementation of append ("a") mode would cause the
|
||||||
O_APPEND flag to be set.
|
O_APPEND flag to be set.
|
||||||
|
|
||||||
(Historical implementations [such as Solaris2] do a one-time
|
(Historical implementations [such as Solaris2] do a one-time
|
||||||
seek in fdopen.)
|
seek in fdopen.)
|
||||||
@ -131,7 +128,7 @@ _IO_new_fdopen (fd, mode)
|
|||||||
though that would seem consistent) because that would be more
|
though that would seem consistent) because that would be more
|
||||||
likely to break historical programs.
|
likely to break historical programs.
|
||||||
*/
|
*/
|
||||||
if ((posix_mode & O_APPEND) && !(fd_flags & O_APPEND))
|
if ((read_write & _IO_IS_APPENDING) && !(fd_flags & O_APPEND))
|
||||||
{
|
{
|
||||||
do_seek = true;
|
do_seek = true;
|
||||||
#ifdef F_SETFL
|
#ifdef F_SETFL
|
||||||
|
Reference in New Issue
Block a user