Paul Eggert wrote:
> diff --git a/lib/unlinkat.c b/lib/unlinkat.c
> index 7fb0371996..6873ba558d 100644
> --- a/lib/unlinkat.c
> +++ b/lib/unlinkat.c
> @@ -71,8 +71,8 @@ rpl_unlinkat (int fd, char const *name, int flag)
> memcpy (short_name, name, len);
> while (len && ISSLASH (short_name[len - 1]))
> short_name[--len] = '\0';
> - if (len && (fstatat (fd, short_name, &st, AT_SYMLINK_NOFOLLOW)
> - || S_ISLNK (st.st_mode)))
> + if (len && (readlinkat (fd, short_name, linkbuf, 1) < 0
> + || errno == EINVAL))
> {
> free (short_name);
> errno = EPERM;
This looks wrong. Copying the logic from lib/unlink.c, I would expect these
two lines to be
if (len && ! (readlinkat (fd, short_name, linkbuf, 1) < 0
&& errno == EINVAL))
or — if you want —
if (len && (readlinkat (fd, short_name, linkbuf, 1) >= 0
|| errno != EINVAL))
Bruno