about summary refs log tree commit diff
path: root/stdlib/test-canon.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2022-03-31 22:00:58 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2022-03-31 22:00:58 +0530
commitb416555431b47a21a855f225c6f5368ae4e4d56c (patch)
tree2b41f3506b38fec710caa1355f20437d910f77c1 /stdlib/test-canon.c
parent7f2ddf7400bb959897a5fe58f7fc5fbe5e57cfae (diff)
downloadglibc-b416555431b47a21a855f225c6f5368ae4e4d56c.tar.gz
glibc-b416555431b47a21a855f225c6f5368ae4e4d56c.tar.xz
glibc-b416555431b47a21a855f225c6f5368ae4e4d56c.zip
realpath: Bring back GNU extension on ENOENT and EACCES [BZ #28996]
The GNU extension for realpath states that if the path resolution fails
with ENOENT or EACCES and the resolved buffer is non-NULL, it will
contain part of the path that failed resolution.

commit 949ad78a189194048df8a253bb31d1d11d919044 broke this when it
omitted the copy on failure.  Bring it back partially to continue
supporting this GNU extension.

Resolves: BZ #28996

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
Diffstat (limited to 'stdlib/test-canon.c')
-rw-r--r--stdlib/test-canon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/test-canon.c b/stdlib/test-canon.c
index 2ad1218749..a9c83be17c 100644
--- a/stdlib/test-canon.c
+++ b/stdlib/test-canon.c
@@ -174,8 +174,8 @@ do_test (int argc, char ** argv)
 	  continue;
 	}
 
-      /* Only on success verify that buf contains the result too.  */
-      if (result != NULL
+      /* Verify buf contents if the call succeeded or failed with ENOENT.  */
+      if ((result != NULL || errno == ENOENT)
 	  && !check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved))
 	{
 	  printf ("%s: flunked test %d (expected resolved `%s', got `%s')\n",