* lib/symlinkat.c (rpl_symlinkat): Don't follow symlinks during the
trailing slash handling.
* modules/symlinkat (Depends-on): Update conditions.
+2021-01-04 Bruno Haible <bruno@clisp.org>
+
+ symlinkat: Fix trailing slash handling.
+ * lib/symlinkat.c (rpl_symlinkat): Don't follow symlinks during the
+ trailing slash handling.
+ * modules/symlinkat (Depends-on): Update conditions.
+
2021-01-04 Bruno Haible <bruno@clisp.org>
mkfifoat: Update module description.
#if HAVE_SYMLINKAT
# undef symlinkat
+#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
if (len && name[len - 1] == '/')
{
struct stat st;
- if (fstatat (fd, name, &st, 0) == 0 || errno == EOVERFLOW)
+ if (fstatat (fd, name, &st, AT_SYMLINK_NOFOLLOW) == 0
+ || errno == EOVERFLOW)
errno = EEXIST;
return -1;
}
Depends-on:
unistd
extensions
+fcntl-h [test $HAVE_SYMLINKAT = 0 || test $REPLACE_SYMLINKAT = 1]
at-internal [test $HAVE_SYMLINKAT = 0]
errno [test $HAVE_SYMLINKAT = 0]
fchdir [test $HAVE_SYMLINKAT = 0]
-fcntl-h [test $HAVE_SYMLINKAT = 0]
filename [test $HAVE_SYMLINKAT = 0]
openat-die [test $HAVE_SYMLINKAT = 0]
openat-h [test $HAVE_SYMLINKAT = 0]