[PATCH 2/3] ISO C23: Port getcwd.m4 to ISO C23

<[email protected]> Wed, 5 Mar 2025 10:56:26 +0100
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
From: Petr Písař <[email protected]>

Some confgure tests failed because of function arguments missing from
the prototypes:

    configure:16105: checking whether getcwd (NULL, 0) allocates memory for result
    configure:16162: gcc -o conftest -g -O2   conftest.c  >&5
    conftest.c:186:16: error: conflicting types for 'getcwd'; have 'char *(void)'
      186 |          char *getcwd ();
	  |                ^~~~~~
    In file included from conftest.c:181:
    /usr/include/unistd.h:531:14: note: previous declaration of 'getcwd' with type 'char *(char *, size_t)'

This patch fixes it.

Maintainer is encouraged to rebase the m4 files to the latest gnulib.

Signed-off-by: Petr Písař <[email protected]>
---
 m4/getcwd.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/m4/getcwd.m4 b/m4/getcwd.m4
index b9fbcec..6f24b14 100644
--- a/m4/getcwd.m4
+++ b/m4/getcwd.m4
@@ -21,7 +21,7 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
 #         include <direct.h>
 #        endif
 #        ifndef getcwd
-         char *getcwd ();
+         char *getcwd (char *buf, size_t size);
 #        endif
 ]], [[
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-- 
2.48.1