From 1566861acefbe2313c5c4585438d410a62dfa0e8 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Tue, 2 Oct 2018 11:24:58 +0000 Subject: [PATCH] macOS: make eina_environment_tmp_get() work as elsewhere. On macOS the tmp file path always terminated with an additional separator, causing issues when making file name comparisons. For example, the Eio test suits would hang due to this. This patch trims any trailing path. When joining paths with eina_environment_tmp_get, macOS should behave similarly as on other architectures. Differential Revision: https://phab.enlightenment.org/D7128 --- src/lib/eina/eina_util.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/eina/eina_util.c b/src/lib/eina/eina_util.c index ae2cebe3f1..290038037d 100644 --- a/src/lib/eina/eina_util.c +++ b/src/lib/eina/eina_util.c @@ -118,6 +118,17 @@ eina_environment_tmp_get(void) } if (!tmp) tmp = "/tmp"; #endif + +#if defined(__MACH__) && defined(__APPLE__) + if (tmp && tmp[strlen(tmp) -1] == '/') + { + char *tmp2 = strdup(tmp); + tmp2[strlen(tmp2) - 1] = 0x0; + tmp = tmp2; + return tmp; + } +#endif + tmp = strdup(tmp); return tmp; }