History log of /freebsd-10-stable/lib/libc/stdio/freopen.c
Revision Date Author Comments
# 321074 17-Jul-2017 kib

MFC r320472,r320508,r320509:
Make stdio deferred cancel-safe.

Requested by: eugen


# 291293 25-Nov-2015 ngie

MFC r264737:

Discussed with: jilles

r264737 (by jilles):

libc/stdio: Fail fdopen() on an execute-only fd.

An execute-only fd (opened with O_EXEC) allows neither read() nor write()
and is therefore incompatible with all stdio modes. Therefore, the [EINVAL]
error applies.

Also adjust the similar check in freopen() with a NULL path, even though
this checks an fd which is already from a FILE.


# 290544 08-Nov-2015 ache

MFC: r289863,r289931,r290110,r290230,r290231,r290232

r290232:

Microoptimize.

r290231:

Addition to prev. commit.
In some edge cases fp->_p can be changed in _sseek(), recalculate.

r290230:

Don't seek to the end if write buffer is empty (in append modes).
PR: 204156

r290110:

Add _flags2 per jhb@ suggestion since no room left in _flags.
Rewrite O_APPEND flag checking using new __S2OAP flag.

r289931:

According to POSIX, a write operation shall start at the current size of
the stream (if mode had 'a' as the first character).

r289863:

Since no room left in the _flags, reuse __SALC for O_APPEND.
It helps to remove _fcntl() call from _ftello() and optimize seek position
calculation in _swrite().


# 269624 06-Aug-2014 ache

MFC: r269116

In the "Too many open files" edge cases don't try to preserve old
number for non-std* descriptors, but close old file and retry.

Obtained from: inspired by Apple's change from pfg@


# 269482 03-Aug-2014 pfg

MFC r268926, r268930, r268983:

Use a correct errno in freopen.
Use EBADF instead of EINVAL when working around incorrect O_ACCMODE.

Adjust errno on failed prepwrite.

rewind: always clear error indicator as required by POSIX.

Obtained from: Apple Inc. (Libc 997.90.3)
Phabric: D442


# 269624 06-Aug-2014 ache

MFC: r269116

In the "Too many open files" edge cases don't try to preserve old
number for non-std* descriptors, but close old file and retry.

Obtained from: inspired by Apple's change from pfg@


# 269482 03-Aug-2014 pfg

MFC r268926, r268930, r268983:

Use a correct errno in freopen.
Use EBADF instead of EINVAL when working around incorrect O_ACCMODE.

Adjust errno on failed prepwrite.

rewind: always clear error indicator as required by POSIX.

Obtained from: Apple Inc. (Libc 997.90.3)
Phabric: D442