[Bug 1839] call read with a write only file descriptor should fall with EBADF

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Tue Jul 19 07:53:40 UTC 2011


https://www.rtems.org/bugzilla/show_bug.cgi?id=1839

--- Comment #2 from Xiang Cui <medivhc at gmail.com> 2011-07-19 02:53:40 CDT ---
fchdir() fchmod() fchown() fpathconf() fsync() do not need check the file
descriptor permission

ftruncate() fails with EBADF or EINVAL when the file was opened without write
permission.

fdatasync() write() and writev() need the file opened with write permission,
otherwise they fail with EBADF 

read() and readv() need the file opened with read permission, otherwise they
fail with EBADF 

So all the these calls need some updates.


(In reply to comment #1)
> Created attachment 1226 [details]
> Patch for Review
> This should address this issue.  Please review and verify it is OK.
> Also please grep "rtems_libio_check_permissions" in libcsupport/src and verify
> it is always correctly used to return the expected status.
> rtems_libio_check_permissions - always returns EINVAL
> rtems_libio_check_permissions_with_error - takes third parameter for errno
> FWIW this is a weird POSIX-ism.  I checked another use of
> rtems_libio_check_permissions() and you could return EBADF or EINVAL. 
> Thanks.

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list