Set the error indicator on an attempt to write to a read-only stream.

PR:		127335
MFC after:	2 weeks
This commit is contained in:
David Schultz 2009-01-08 06:38:06 +00:00
parent 4984f138f8
commit 0cab1fd236

View File

@ -60,6 +60,7 @@ __swsetup(fp)
if ((fp->_flags & __SWR) == 0) { if ((fp->_flags & __SWR) == 0) {
if ((fp->_flags & __SRW) == 0) { if ((fp->_flags & __SRW) == 0) {
errno = EBADF; errno = EBADF;
fp->_flags |= __SERR;
return (EOF); return (EOF);
} }
if (fp->_flags & __SRD) { if (fp->_flags & __SRD) {