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

non-writable fd.
This commit is contained in:
Christopher Faylor 2002-05-12 04:43:29 +00:00
parent 48897dfeb9
commit b4f8d31f3b
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2002-05-12 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (_read): Change error to EBADF if attempt to write to a
non-writable fd.
2002-05-11 Christopher Faylor <cgf@redhat.com>
* fhandler.h (executable_states): For now, make dont_care_if_executable

View File

@ -340,6 +340,14 @@ _read (int fd, void *ptr, size_t len)
}
out:
if (res && get_errno () == EACCES &&
!(cfd->get_flags () & (O_RDONLY | O_RDWR)))
{
set_errno (EBADF);
break;
}
if (res >= 0 || get_errno () != EINTR || !thisframe.call_signal_handler ())
break;
set_errno (e);