mirror of
https://github.com/curl/curl.git
synced 2026-08-25 11:03:38 +03:00
curlx: dedupe basename copies into curlx_basename()
Also stop redefining system `basename()` symbol. Call `curlx_basename()` instead, and map that to `basename()` if available. Closes #20424
This commit is contained in:
parent
0e2507a3c6
commit
6974bd7cc8
7 changed files with 54 additions and 79 deletions
|
|
@ -25,10 +25,6 @@
|
|||
|
||||
#if defined(_WIN32) || defined(MSDOS)
|
||||
|
||||
#if defined(HAVE_LIBGEN_H) && defined(HAVE_BASENAME)
|
||||
# include <libgen.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <tlhelp32.h>
|
||||
# undef PATH_MAX
|
||||
|
|
@ -41,7 +37,6 @@
|
|||
#endif
|
||||
|
||||
#include "tool_cfgable.h"
|
||||
#include "tool_bname.h"
|
||||
#include "tool_doswin.h"
|
||||
#include "tool_msgs.h"
|
||||
|
||||
|
|
@ -327,7 +322,7 @@ static SANITIZEcode rename_if_reserved_dos(char ** const sanitized,
|
|||
|
||||
memcpy(buffer, file_name, len + 1);
|
||||
|
||||
base = basename(buffer);
|
||||
base = curlx_basename(buffer);
|
||||
|
||||
/* Rename reserved device names that are known to be accessible without \\.\
|
||||
Examples: CON => _CON, CON.EXT => CON_EXT, CON:ADS => CON_ADS
|
||||
|
|
@ -378,7 +373,7 @@ static SANITIZEcode rename_if_reserved_dos(char ** const sanitized,
|
|||
|
||||
/* the basename pointer must be updated since the path has expanded */
|
||||
if(p == buffer)
|
||||
base = basename(buffer);
|
||||
base = curlx_basename(buffer);
|
||||
}
|
||||
|
||||
/* This is the legacy portion from rename_if_dos_device_name that checks for
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue