bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] getcwd: merge recent glibc changes


From: Paul Eggert
Subject: [PATCH] getcwd: merge recent glibc changes
Date: Wed, 9 Sep 2020 18:29:59 -0700

* 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  <eggert@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  <bruno@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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]