[PATCH] tst-realpath-toolong: Fix hurd build

Siddhesh Poyarekar siddhesh@sourceware.org
Sat Jan 22 14:45:23 GMT 2022


We don't really need a bigger buffer for realpath since it should fail
and return NULL.  In the bug too, the buffer itself is not accessed; it
is in fact left untouched.  Drop the PATH_MAX use and pass a single char
address.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
---
 stdlib/tst-realpath-toolong.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stdlib/tst-realpath-toolong.c b/stdlib/tst-realpath-toolong.c
index 8bed772460..ed84787a32 100644
--- a/stdlib/tst-realpath-toolong.c
+++ b/stdlib/tst-realpath-toolong.c
@@ -34,8 +34,8 @@ do_test (void)
 {
   char *base = support_create_and_chdir_toolong_temp_directory (BASENAME);
 
-  char buf[PATH_MAX + 1];
-  const char *res = realpath (".", buf);
+  char buf;
+  const char *res = realpath (".", &buf);
 
   /* canonicalize.c states that if the real path is >= PATH_MAX, then
      realpath returns NULL and sets ENAMETOOLONG.  */
-- 
2.34.1



More information about the Libc-alpha mailing list