Reported by Zach van Rijn <me@zv.io> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-04/msg00072.html>
and <https://git.adelielinux.org/adelie/packages/-/issues/987>.
* lib/getcwd.c (__getcwd_generic): Remove a trailing slash from the
result of readlink().
+2024-12-31 Bruno Haible <bruno@clisp.org>
+
+ getcwd: Return "/bin" instead of "//bin" on Adélie Linux.
+ Reported by Zach van Rijn <me@zv.io> in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2023-04/msg00072.html>
+ and <https://git.adelielinux.org/adelie/packages/-/issues/987>.
+ * lib/getcwd.c (__getcwd_generic): Remove a trailing slash from the
+ result of readlink().
+
2024-12-28 Bruno Haible <bruno@clisp.org>
assert-h, verify: Make static_assert work in C++ mode on FreeBSD 11.
}
else
{
+ /* *dirp is already a '/' (see above). Therefore if the directory
+ ends in a slash, we can remove that slash. This happens in
+ particular if the directory is "/". */
+ if (linklen > 0 && linkbuf[linklen - 1] == '/')
+ linklen--;
+
dirroom = dirp - dir;
if (dirroom < linklen)
{