aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/canonicalize.c4
-rw-r--r--stdlib/test-canon.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index 6caed9e..6237a41 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -400,11 +400,11 @@ realpath_stk (const char *name, char *resolved,
error:
*dest++ = '\0';
- if (resolved != NULL)
+ if (!failed && resolved != NULL)
{
if (dest - rname <= get_path_max ())
rname = strcpy (resolved, rname);
- else if (!failed)
+ else
{
failed = true;
__set_errno (ENAMETOOLONG);
diff --git a/stdlib/test-canon.c b/stdlib/test-canon.c
index 185ccf4..2ad1218 100644
--- a/stdlib/test-canon.c
+++ b/stdlib/test-canon.c
@@ -174,7 +174,9 @@ do_test (int argc, char ** argv)
continue;
}
- if (!check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved))
+ /* Only on success verify that buf contains the result too. */
+ if (result != NULL
+ && !check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved))
{
printf ("%s: flunked test %d (expected resolved `%s', got `%s')\n",
argv[0], i, tests[i].out ? tests[i].out : tests[i].resolved,