* lib/getcwd.c (GETCWD_RETURN_TYPE) [!_LIBC]: New macro. (__getcwd, getcwd) [_LIBC && !GETCWD_RETURN_TYPE]: Add aliases. --- ChangeLog | 6 ++++++ lib/getcwd.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog index ff4bee306..c554e5672 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-09-09 Paul Eggert <egg...@cs.ucla.edu> + + getcwd: merge recent glibc changes + * lib/getcwd.c (GETCWD_RETURN_TYPE) [!_LIBC]: New macro. + (__getcwd, getcwd) [_LIBC && !GETCWD_RETURN_TYPE]: Add aliases. + 2020-09-06 Bruno Haible <br...@clisp.org> attribute: Clarify which file to include. diff --git a/lib/getcwd.c b/lib/getcwd.c index 61d2d0610..9b74b7b0c 100644 --- a/lib/getcwd.c +++ b/lib/getcwd.c @@ -89,6 +89,7 @@ #endif #if !_LIBC +# define GETCWD_RETURN_TYPE char * # define __close_nocancel_nostatus close # define __getcwd_generic rpl_getcwd # define stat64 stat @@ -154,7 +155,7 @@ getcwd_nothrow (char *buf, size_t size) if BUF is NULL, an array is allocated with 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case it is as big as necessary. */ -char * +GETCWD_RETURN_TYPE __getcwd_generic (char *buf, size_t size) { /* Lengths of big file name components and entire file names, and a @@ -487,3 +488,8 @@ __getcwd_generic (char *buf, size_t size) } return NULL; } + +#if defined _LIBC && !defined GETCWD_RETURN_TYPE +libc_hidden_def (__getcwd) +weak_alias (__getcwd, getcwd) +#endif -- 2.25.4