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 <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Andrew Deason 2023-05-17 14:57:03 -05:00
parent e34e7bdf42
commit ba762b83d4

View File

@ -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 /* 'tdir' points to the 'tests' dir, so go up one level to get to the top
* srcdir/objdir. */ * srcdir/objdir. */
top_rel = afstest_asprintf("%s/..", tdir); top_rel = afstest_asprintf("%s/..", tdir);
top_abs = realpath(top_rel, NULL); top_abs = bcalloc(1, PATH_MAX);
free(top_rel); top_abs = realpath(top_rel, top_abs);
if (top_abs == NULL) { if (top_abs == NULL) {
sysbail("realpath"); sysbail("realpath");
} }
free(top_rel);
/* /*
* The given 'filename' is relative to the top srcdir/objdir, so to get the * 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 * full path, append 'filename' to the top srcdir/objdir. Note that the