From: Bruno Haible Date: Thu, 14 Aug 2025 20:31:48 +0000 (+0200) Subject: unlinkat: Use issymlinkat. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f61201292ebc36cb531530ed40d69c768981637;p=thirdparty%2Fgnulib.git unlinkat: Use issymlinkat. * lib/unlinkat.c (rpl_unlinkat): Use issymlinkat instead of readlinkat. * modules/unlinkat (Depends-on): Remove readlinkat. Add issymlinkat. --- diff --git a/ChangeLog b/ChangeLog index 6fcc5d6eae..7f89069879 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-08-14 Bruno Haible + + unlinkat: Use issymlinkat. + * lib/unlinkat.c (rpl_unlinkat): Use issymlinkat instead of readlinkat. + * modules/unlinkat (Depends-on): Remove readlinkat. Add issymlinkat. + 2025-08-14 Bruno Haible unlink: Use issymlink. diff --git a/lib/unlinkat.c b/lib/unlinkat.c index f2a9d4e93c..847a379a91 100644 --- a/lib/unlinkat.c +++ b/lib/unlinkat.c @@ -71,9 +71,7 @@ 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'; - char linkbuf[1]; - if (len && ! (readlinkat (fd, short_name, linkbuf, 1) < 0 - && errno == EINVAL)) + if (len && issymlinkat (fd, short_name) != 0) { free (short_name); errno = EPERM; diff --git a/modules/unlinkat b/modules/unlinkat index aaacfd936a..24232c431d 100644 --- a/modules/unlinkat +++ b/modules/unlinkat @@ -13,6 +13,8 @@ extensions fcntl-h [test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1] openat-h [test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1] sys_stat-h [test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1] +fstatat [test $REPLACE_UNLINKAT = 1] +issymlinkat [test $REPLACE_UNLINKAT = 1] at-internal [test $HAVE_UNLINKAT = 0] errno-h [test $HAVE_UNLINKAT = 0] fchdir [test $HAVE_UNLINKAT = 0] @@ -21,8 +23,6 @@ openat-die [test $HAVE_UNLINKAT = 0] rmdir [test $HAVE_UNLINKAT = 0] save-cwd [test $HAVE_UNLINKAT = 0] unlink [test $HAVE_UNLINKAT = 0] -fstatat [test $REPLACE_UNLINKAT = 1] -readlinkat [test $REPLACE_UNLINKAT = 1] configure.ac: gl_FUNC_UNLINKAT