aboutsummaryrefslogtreecommitdiffstats
path: root/lib/faccessat.c
diff options
context:
space:
mode:
authorPaul Eggert2020-12-25 02:33:29 -0800
committerPaul Eggert2020-12-25 02:36:03 -0800
commit42d58264db165d265cba68d6dbebc53a50738355 (patch)
tree87543f2f0992a6b57a34dbd6ee04f48c3f6e7486 /lib/faccessat.c
parent5880c7caab394eac55c44d4be42b2f45dbd9bc53 (diff)
downloademacs-42d58264db165d265cba68d6dbebc53a50738355.tar.gz
emacs-42d58264db165d265cba68d6dbebc53a50738355.zip
Update Gnulib.
All changes in this commit are autogenerated by running admin/merge-gnulib.
Diffstat (limited to 'lib/faccessat.c')
-rw-r--r--lib/faccessat.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/faccessat.c b/lib/faccessat.c
index 9f6a11bf6e3..330c54a0be2 100644
--- a/lib/faccessat.c
+++ b/lib/faccessat.c
@@ -32,6 +32,13 @@
32#include <sys/stat.h> 32#include <sys/stat.h>
33#undef _GL_INCLUDING_UNISTD_H 33#undef _GL_INCLUDING_UNISTD_H
34 34
35#ifndef FACCESSAT_NEVER_EOVERFLOWS
36# define FACCESSAT_NEVER_EOVERFLOWS 0
37#endif
38#ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK
39# define LSTAT_FOLLOWS_SLASHED_SYMLINK 0
40#endif
41
35#if HAVE_FACCESSAT 42#if HAVE_FACCESSAT
36static int 43static int
37orig_faccessat (int fd, char const *name, int mode, int flag) 44orig_faccessat (int fd, char const *name, int mode, int flag)
@@ -59,7 +66,12 @@ rpl_faccessat (int fd, char const *file, int mode, int flag)
59{ 66{
60 int result = orig_faccessat (fd, file, mode, flag); 67 int result = orig_faccessat (fd, file, mode, flag);
61 68
62 if (result == 0 && file[strlen (file) - 1] == '/') 69 if (result != 0)
70 {
71 if (!FACCESSAT_NEVER_EOVERFLOWS && mode == F_OK && errno == EOVERFLOW)
72 return 0;
73 }
74 else if (!LSTAT_FOLLOWS_SLASHED_SYMLINK && file[strlen (file) - 1] == '/')
63 { 75 {
64 struct stat st; 76 struct stat st;
65 result = fstatat (fd, file, &st, 0); 77 result = fstatat (fd, file, &st, 0);