]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r264737:
authorngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 25 Nov 2015 08:19:01 +0000 (08:19 +0000)
committerngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 25 Nov 2015 08:19:01 +0000 (08:19 +0000)
commit35777eb43122bed39670d58a6989ba77e6813f5d
treef9247d6d56ccebd8b033ebbdcbd3090bc7961c28
parent7e2aaa022b1dc46359264ae775176baf47385822
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.

git-svn-id: svn://svn.freebsd.org/base/stable/10@291293 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libc/stdio/fdopen.c
lib/libc/stdio/freopen.c
tools/regression/lib/libc/stdio/Makefile
tools/regression/lib/libc/stdio/test-fdopen.c [new file with mode: 0644]
tools/regression/lib/libc/stdio/test-fdopen.t [new file with mode: 0644]
tools/regression/lib/libc/stdio/test-freopen.c [new file with mode: 0644]
tools/regression/lib/libc/stdio/test-freopen.t [new file with mode: 0644]