configure/cmake: check for realpath

And make vtls_scache use HAVE_REALPATH

Fixes #16209
Reported-by: Andrew Kirillov
Closes #16225
This commit is contained in:
Daniel Stenberg 2025-02-06 22:35:09 +01:00
parent 1bf774df57
commit c0d38f547b
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
4 changed files with 9 additions and 2 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 <poll.h> header file. */
#cmakedefine HAVE_POLL_H 1

View File

@ -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) {