stefan pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=0e61c08c2b38eaf88f0d8078fbba41e63e1f00cf
commit 0e61c08c2b38eaf88f0d8078fbba41e63e1f00cf Author: Wander Lairson Costa <[email protected]> Date: Wed Jun 24 13:32:12 2020 +0000 Fix eina file thread test on Windows On windows, we try to open the "cmd.exe" file, but without the full path the test fails unless it runs from the system directory. We now use the full path to test the eina_file_open function. Reviewed-by: Stefan Schmidt <[email protected]> Reviewed-by: Vincent Torri <[email protected]> Reviewed-by: João Paulo Taylor Ienczak Zanette <[email protected]> Differential Revision: https://phab.enlightenment.org/D12021 --- src/tests/eina/eina_test_file.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c index 0ed1c93d75..bcaff19e40 100644 --- a/src/tests/eina/eina_test_file.c +++ b/src/tests/eina/eina_test_file.c @@ -490,7 +490,29 @@ static void * _eina_test_file_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED) { #ifdef _WIN32 - const char *filename = "cmd.exe"; + char filename[MAX_PATH]; + size_t len; + const char test_file[] = "cmd.exe"; + + fail_if(!GetSystemDirectoryA(filename, MAX_PATH)); + + len = strlen(filename); + + /* + * Check the buffer size. + * The system path length + path separator + length of the test_file + null terminator + * Must fit in MAX_PATH. + */ + fail_if(MAX_PATH < len + 1 + sizeof(test_file)); + + // append trailing directory separator if there isn't one + if (filename[len - 1] != '\\' && filename[len - 1] != '/') + { + filename[len] = '\\'; + filename[len + 1] = '\0'; + } + + strncat(filename, test_file, MAX_PATH - len - 2); #else const char *filename = "/bin/sh"; #endif --
