bug-gnulib
[Top][All Lists]
Advanced

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

getcwd: Fix compilation error in C23 mode


From: Bruno Haible
Subject: getcwd: Fix compilation error in C23 mode
Date: Thu, 09 Feb 2023 12:54:20 +0100

When compiling a Gnulib testdir with clang15 with -std=gnu2x option,
I see this compilation error:

../../gllib/getcwd.c:460:11: error: use of undeclared identifier 'sprintf'
          sprintf (namebuf, "/proc/self/fd/%u", (unsigned int) fd);
          ^
1 error generated.

Fixed as follows.


2023-02-09  Bruno Haible  <bruno@clisp.org>

        getcwd: Fix compilation error in C23 mode.
        * lib/getcwd.c: Include <stdio.h>.

diff --git a/lib/getcwd.c b/lib/getcwd.c
index 5201cd06b5..0530630c43 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -16,6 +16,7 @@
 
 #if !_LIBC
 # include <config.h>
+# include <stdio.h>
 # include <unistd.h>
 # include "pathmax.h"
 #else






reply via email to

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