This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[1.7] bugs in faccessat


faccessat has at least two, and probably three bugs.

First, a typo - the EINVAL check is done against flags (the fourth argument) 
rather than mode (third argument), such that faccessat(AT_FDCWD,".",-1,0) 
passes even though the corresponding access(".",-1) fails.

Second, it is not performing the proper checks when AT_EACCESS is set and the 
applications' effective id differs from the real id (to fix this would require 
adding a parameter to fhandler_base::fhaccess).  If this latter bug is fixed, 
then it would be nice to copy Linux and export:

euidaccess(file,mode) => faccessat(AT_FDCWD,file,mode,AT_EACCESS)
eaccess(file,mode) => euidaccess(file,mode)

Third, POSIX permits us to return EINVAL to reject flags we don't support.  For 
example, both:

faccessat(fd,name,F_OK,AT_REMOVEDIR)
fchownat(fd,name,uid,gid,AT_EACCESS)

should probably fail with EINVAL.  In other words, we should support only the 
following:

faccessat - AT_SYMLINK_NOFOLLOW, AT_EACCESS (POSIX doesn't require 
AT_SYMLINK_NOFOLLOW, but Linux supports it)
fchownat, fchmodat, fstatat, utimensat - AT_SYMLINK_NOFOLLOW
linkat - AT_SYMLINK_FOLLOW
unlinkat - AT_REMOVEDIR

-- 
Eric Blake




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]