From: Daniel Stenberg Date: Thu, 6 Feb 2025 21:35:09 +0000 (+0100) Subject: configure/cmake: check for realpath X-Git-Tag: curl-8_12_1~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c0d38f547b5218cd2bca5e3f01b8e79c0a6c4903;p=thirdparty%2Fcurl.git configure/cmake: check for realpath And make vtls_scache use HAVE_REALPATH Fixes #16209 Reported-by: Andrew Kirillov Closes #16225 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 810dcbbc6d..b2b4434797 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1735,6 +1735,7 @@ check_function_exists("setmode" HAVE_SETMODE) check_function_exists("setrlimit" HAVE_SETRLIMIT) if(NOT WIN32) + check_function_exists("realpath" HAVE_REALPATH) check_function_exists("sched_yield" HAVE_SCHED_YIELD) check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP) check_symbol_exists("stricmp" "string.h" HAVE_STRICMP) diff --git a/configure.ac b/configure.ac index d492f9e941..a2879568ea 100644 --- a/configure.ac +++ b/configure.ac @@ -4080,7 +4080,10 @@ AC_CHECK_FUNCS([\ ]) if test "$curl_cv_native_windows" != 'yes'; then - AC_CHECK_FUNCS([sched_yield]) + AC_CHECK_FUNCS([\ + sched_yield \ + realpath \ + ]) CURL_CHECK_FUNC_STRCASECMP CURL_CHECK_FUNC_STRCMPI CURL_CHECK_FUNC_STRICMP diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index a41af0c982..f4f3a186d4 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -433,6 +433,9 @@ /* If you have poll */ #cmakedefine HAVE_POLL 1 +/* If you have realpath */ +#cmakedefine HAVE_REALPATH 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_POLL_H 1 diff --git a/lib/vtls/vtls_scache.c b/lib/vtls/vtls_scache.c index 9c04b77623..4250a6c69a 100644 --- a/lib/vtls/vtls_scache.c +++ b/lib/vtls/vtls_scache.c @@ -359,7 +359,7 @@ static CURLcode cf_ssl_peer_key_add_path(struct dynbuf *buf, char abspath[_MAX_PATH]; if(_fullpath(abspath, path, _MAX_PATH)) return Curl_dyn_addf(buf, ":%s-%s", name, abspath); -#else +#elif defined(HAVE_REALPATH) if(path[0] != '/') { char *abspath = realpath(path, NULL); if(abspath) {