From ba762b83d41d9d4e10d5de0ec91ebf8205ce57d1 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 17 May 2023 14:57:03 -0500 Subject: [PATCH] tests: Avoid realpath(x, NULL) Giving NULL as the second argument to realpath isn't supported by some platforms, including Solaris 10. Pass an allocated buffer instead. Change-Id: Iec1268906d6a032e1b38b120e54fa5d9c31102c6 Reviewed-on: https://gerrit.openafs.org/15438 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Andrew Deason --- tests/common/files.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/common/files.c b/tests/common/files.c index 32735df527..face8be28e 100644 --- a/tests/common/files.c +++ b/tests/common/files.c @@ -120,12 +120,14 @@ path_from_tdir(char *env_var, char *filename) /* 'tdir' points to the 'tests' dir, so go up one level to get to the top * srcdir/objdir. */ top_rel = afstest_asprintf("%s/..", tdir); - top_abs = realpath(top_rel, NULL); - free(top_rel); + top_abs = bcalloc(1, PATH_MAX); + top_abs = realpath(top_rel, top_abs); if (top_abs == NULL) { sysbail("realpath"); } + free(top_rel); + /* * The given 'filename' is relative to the top srcdir/objdir, so to get the * full path, append 'filename' to the top srcdir/objdir. Note that the