1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-04-28 06:33:36 +00:00

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().
This commit is contained in:
Bruno Haible
2024-12-31 19:38:42 +01:00
parent e6f85072a7
commit ba64359b44
2 changed files with 15 additions and 0 deletions

View File

@@ -1,3 +1,12 @@
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.

View File

@@ -478,6 +478,12 @@ __getcwd_generic (char *buf, size_t size)
}
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)
{