* syscalls.cc (_write): Change error to EBADF if attempt to write to a

non-writable fd.
This commit is contained in:
Christopher Faylor 2002-05-09 22:55:08 +00:00
parent 62ae6f36e2
commit f561f644e9
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2002-05-09 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (_write): Change error to EBADF if attempt to write to a
non-writable fd.
2002-05-08 Corinna Vinschen <corinna@vinschen.de>
* cygheap.h (class cygheap_user): Add member `orig_psid'.

View File

@ -384,6 +384,9 @@ _write (int fd, const void *ptr, size_t len)
myself->process_state |= PID_TTYOU;
res = cfd->write (ptr, len);
myself->process_state &= ~PID_TTYOU;
if (res && get_errno () == EACCES &&
!(cfd->get_flags () & (O_WRONLY | O_RDWR)))
set_errno (EBADF);
}
done: