[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 13:39:06 UTC 2011


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

Joel Sherrill <joel.sherrill at oarcorp.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joel.sherrill at oarcorp.com

--- Comment #3 from Joel Sherrill <joel.sherrill at oarcorp.com> 2011-07-19 08:39:05 CDT ---
(In reply to comment #2)
> fchdir() fchmod() fchown() fpathconf() fsync() do not need check the file
> descriptor permission

Addressed in patch.

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

This doesn't require a code change as best I can tell to be compliant.
But what does Linux return?  better to be consistent with Linux.

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

Addressed in patch.

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

I think this is fixed in the patch.

> So all the these calls need some updates.

Please check the attached patch.  If OK, I will fix the tests.

> 
> (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