/* 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
#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
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 */