1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

windows: Define PATH_MAX to MAX_PATH

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: Ib3358ecb029d93c263d3cb39da25e82a772ae2c7
This commit is contained in:
Xiang Xiao
2021-05-19 18:20:38 +08:00
committed by Jakub Jelen
parent 592d256a0b
commit 672c1f8a3a
3 changed files with 15 additions and 11 deletions

View File

@@ -169,7 +169,11 @@ int gettimeofday(struct timeval *__p, void *__t);
/* some constants */ /* some constants */
#ifndef PATH_MAX #ifndef PATH_MAX
# define PATH_MAX 4096 #ifdef MAX_PATH
#define PATH_MAX MAX_PATH
#else
#define PATH_MAX 4096
#endif
#endif #endif
#ifndef MAX_PACKET_LEN #ifndef MAX_PACKET_LEN

View File

@@ -105,7 +105,7 @@
#ifdef _WIN32 #ifdef _WIN32
char *ssh_get_user_home_dir(void) { char *ssh_get_user_home_dir(void) {
char tmp[MAX_PATH] = {0}; char tmp[PATH_MAX] = {0};
char *szPath = NULL; char *szPath = NULL;
if (SHGetSpecialFolderPathA(NULL, tmp, CSIDL_PROFILE, TRUE)) { if (SHGetSpecialFolderPathA(NULL, tmp, CSIDL_PROFILE, TRUE)) {

View File

@@ -1328,8 +1328,8 @@ end:
char *torture_make_temp_dir(const char *template) char *torture_make_temp_dir(const char *template)
{ {
DWORD rc = 0; DWORD rc = 0;
char tmp_dir_path[MAX_PATH]; char tmp_dir_path[PATH_MAX];
char tmp_file_name[MAX_PATH]; char tmp_file_name[PATH_MAX];
char *prefix = NULL; char *prefix = NULL;
char *path = NULL; char *path = NULL;
char *prefix_end = NULL; char *prefix_end = NULL;
@@ -1357,8 +1357,8 @@ char *torture_make_temp_dir(const char *template)
*prefix_end = '\0'; *prefix_end = '\0';
} }
rc = GetTempPathA(MAX_PATH, tmp_dir_path); rc = GetTempPathA(PATH_MAX, tmp_dir_path);
if ((rc > MAX_PATH) || (rc == 0)) { if ((rc > PATH_MAX) || (rc == 0)) {
goto free_prefix; goto free_prefix;
} }
@@ -1399,7 +1399,7 @@ static int recursive_rm_dir_content(const char *path)
DWORD last_error = 0; DWORD last_error = 0;
char file_path[MAX_PATH]; char file_path[PATH_MAX];
int rc = 0; int rc = 0;
BOOL removed; BOOL removed;
@@ -1507,8 +1507,8 @@ int torture_isdir(const char *path)
char *torture_create_temp_file(const char *template) char *torture_create_temp_file(const char *template)
{ {
DWORD rc = 0; DWORD rc = 0;
char tmp_dir_path[MAX_PATH]; char tmp_dir_path[PATH_MAX];
char tmp_file_name[MAX_PATH]; char tmp_file_name[PATH_MAX];
char *prefix = NULL; char *prefix = NULL;
char *path = NULL; char *path = NULL;
char *prefix_end = NULL; char *prefix_end = NULL;
@@ -1534,8 +1534,8 @@ char *torture_create_temp_file(const char *template)
*prefix_end = '\0'; *prefix_end = '\0';
} }
rc = GetTempPathA(MAX_PATH, tmp_dir_path); rc = GetTempPathA(PATH_MAX, tmp_dir_path);
if ((rc > MAX_PATH) || (rc == 0)) { if ((rc > PATH_MAX) || (rc == 0)) {
goto free_prefix; goto free_prefix;
} }