X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fopenat.h;h=11a0314d2426d820ae0c39bfe9e58e8f7eeb6b7d;hb=75ce01c4382e5acf45599baaade587f78ddfa956;hp=1d8596fd86b589845c13a0f5d2a6f0e90bc9663f;hpb=52c658e92436e7ef2d7c7b6f7ee69ae4431b6d7d;p=gnulib.git diff --git a/lib/openat.h b/lib/openat.h index 1d8596fd8..11a0314d2 100644 --- a/lib/openat.h +++ b/lib/openat.h @@ -1,5 +1,5 @@ /* provide a replacement openat function - Copyright (C) 2004-2006, 2008-2009 Free Software Foundation, Inc. + Copyright (C) 2004-2006, 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ #if !HAVE_OPENAT int openat_permissive (int fd, char const *file, int flags, mode_t mode, - int *cwd_errno); + int *cwd_errno); bool openat_needs_fchdir (void); #else @@ -81,4 +81,34 @@ lchmodat (int fd, char const *file, mode_t mode) return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW); } +static inline int +statat (int fd, char const *name, struct stat *st) +{ + return fstatat (fd, name, st, 0); +} + +static inline int +lstatat (int fd, char const *name, struct stat *st) +{ + return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW); +} + +#if GNULIB_FACCESSAT +/* For now, there are no wrappers named laccessat or leuidaccessat, + since gnulib doesn't support faccessat(,AT_SYMLINK_NOFOLLOW) and + since access rights on symlinks are of limited utility. */ + +static inline int +accessat (int fd, char const *file, int mode) +{ + return faccessat (fd, file, mode, 0); +} + +static inline int +euidaccessat (int fd, char const *file, int mode) +{ + return faccessat (fd, file, mode, AT_EACCESS); +} +#endif + #endif /* _GL_HEADER_OPENAT */