diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-01-10 01:58:23 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-01-10 02:03:28 +0100 |
commit | 09085ede12fb9650f286bdcd805609ae69f80618 (patch) | |
tree | a58902ab9e473511081c17af337626aa4ef9455f /sysdeps/mach/hurd/euidaccess.c | |
parent | 87faac55161d7dd62997fb09e9fcb5890cf6e4c6 (diff) | |
download | glibc-09085ede12fb9650f286bdcd805609ae69f80618.tar.gz glibc-09085ede12fb9650f286bdcd805609ae69f80618.tar.xz glibc-09085ede12fb9650f286bdcd805609ae69f80618.zip |
hurd: Implement faccessat without AT_EACCESS flag
* hurd/hurd/fd.h: Include <fcntl.h> (__hurd_at_flags): New function. * hurd/lookup-at.c (__file_name_lookup_at): Replace flag computation with call to __hurd_at_flags. * include/unistd.h (__faccessat, __faccessat_noerrno): Add declaration. * sysdeps/mach/hurd/access.c (access_common): Move implementation to __faccessat (hurd_fail_seterrno, hurd_fail_noerrno): Move to sysdeps/mach/hurd/faccessat.c. (__access_noerrno): Use __faccessat_common instead of access_common. (__access): Likewise. * sysdeps/mach/hurd/euidaccess.c (__euidaccess): Replace implementation with a call to __faccessat. * sysdeps/mach/hurd/faccessat.c (faccessat): Rename into... (__faccessat_common): ... this. Move implementation of __access into it when AT_FLAGS does not contain AT_EACCESS. Make it call __hurd_at_flags, add reauthenticate_cwdir_at helper to implement AT mechanism. (__faccessat_noerrno): New function, just calls __faccessat_common. (__faccessat): New function, just calls __faccessat_common. (faccessat): Define weak alias.
Diffstat (limited to 'sysdeps/mach/hurd/euidaccess.c')
-rw-r--r-- | sysdeps/mach/hurd/euidaccess.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/sysdeps/mach/hurd/euidaccess.c b/sysdeps/mach/hurd/euidaccess.c index 613872a207..2c7ce1f2b6 100644 --- a/sysdeps/mach/hurd/euidaccess.c +++ b/sysdeps/mach/hurd/euidaccess.c @@ -16,42 +16,13 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <errno.h> -#include <stddef.h> #include <unistd.h> #include <fcntl.h> -#include <hurd.h> int __euidaccess (const char *file, int type) { - error_t err; - file_t port; - int allowed, flags; - - port = __file_name_lookup (file, 0, 0); - if (port == MACH_PORT_NULL) - return -1; - - /* Find out what types of access we are allowed to this file. */ - err = __file_check_access (port, &allowed); - __mach_port_deallocate (__mach_task_self (), port); - if (err) - return __hurd_fail (err); - - flags = 0; - if (type & R_OK) - flags |= O_READ; - if (type & W_OK) - flags |= O_WRITE; - if (type & X_OK) - flags |= O_EXEC; - - if (flags & ~allowed) - /* We are not allowed all the requested types of access. */ - return __hurd_fail (EACCES); - - return 0; + return __faccessat (AT_FDCWD, file, type, AT_EACCESS); } weak_alias (__euidaccess, euidaccess) weak_alias (__euidaccess, eaccess) |