Commit 45a3b9cd by Matt Keeler

tests: fix issue with /tmp paths on macOS[1]

parent 0eca4230
#ifdef __APPLE__
#include <sys/syslimits.h>
#endif
static char _clar_path[4096]; static char _clar_path[4096];
static int static int
...@@ -31,6 +35,10 @@ find_tmp_path(char *buffer, size_t length) ...@@ -31,6 +35,10 @@ find_tmp_path(char *buffer, size_t length)
continue; continue;
if (is_valid_tmp_path(env)) { if (is_valid_tmp_path(env)) {
#ifdef __APPLE__
if (length >= PATH_MAX && realpath(env, buffer) != NULL)
return 0;
#endif
strncpy(buffer, env, length); strncpy(buffer, env, length);
return 0; return 0;
} }
...@@ -38,6 +46,10 @@ find_tmp_path(char *buffer, size_t length) ...@@ -38,6 +46,10 @@ find_tmp_path(char *buffer, size_t length)
/* If the environment doesn't say anything, try to use /tmp */ /* If the environment doesn't say anything, try to use /tmp */
if (is_valid_tmp_path("/tmp")) { if (is_valid_tmp_path("/tmp")) {
#ifdef __APPLE__
if (length >= PATH_MAX && realpath("/tmp", buffer) != NULL)
return 0;
#endif
strncpy(buffer, "/tmp", length); strncpy(buffer, "/tmp", length);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment