aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libssh/priv.h6
-rw-r--r--src/misc.c2
-rw-r--r--tests/torture.c18
3 files changed, 15 insertions, 11 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 3e549b79..b4729bb8 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -169,7 +169,11 @@ int gettimeofday(struct timeval *__p, void *__t);
/* some constants */
#ifndef PATH_MAX
-# define PATH_MAX 4096
+#ifdef MAX_PATH
+#define PATH_MAX MAX_PATH
+#else
+#define PATH_MAX 4096
+#endif
#endif
#ifndef MAX_PACKET_LEN
diff --git a/src/misc.c b/src/misc.c
index 167beaf1..dff76519 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -105,7 +105,7 @@
#ifdef _WIN32
char *ssh_get_user_home_dir(void) {
- char tmp[MAX_PATH] = {0};
+ char tmp[PATH_MAX] = {0};
char *szPath = NULL;
if (SHGetSpecialFolderPathA(NULL, tmp, CSIDL_PROFILE, TRUE)) {
diff --git a/tests/torture.c b/tests/torture.c
index 3d9eb40d..2d21b3b9 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -1328,8 +1328,8 @@ end:
char *torture_make_temp_dir(const char *template)
{
DWORD rc = 0;
- char tmp_dir_path[MAX_PATH];
- char tmp_file_name[MAX_PATH];
+ char tmp_dir_path[PATH_MAX];
+ char tmp_file_name[PATH_MAX];
char *prefix = NULL;
char *path = NULL;
char *prefix_end = NULL;
@@ -1357,8 +1357,8 @@ char *torture_make_temp_dir(const char *template)
*prefix_end = '\0';
}
- rc = GetTempPathA(MAX_PATH, tmp_dir_path);
- if ((rc > MAX_PATH) || (rc == 0)) {
+ rc = GetTempPathA(PATH_MAX, tmp_dir_path);
+ if ((rc > PATH_MAX) || (rc == 0)) {
goto free_prefix;
}
@@ -1399,7 +1399,7 @@ static int recursive_rm_dir_content(const char *path)
DWORD last_error = 0;
- char file_path[MAX_PATH];
+ char file_path[PATH_MAX];
int rc = 0;
BOOL removed;
@@ -1507,8 +1507,8 @@ int torture_isdir(const char *path)
char *torture_create_temp_file(const char *template)
{
DWORD rc = 0;
- char tmp_dir_path[MAX_PATH];
- char tmp_file_name[MAX_PATH];
+ char tmp_dir_path[PATH_MAX];
+ char tmp_file_name[PATH_MAX];
char *prefix = NULL;
char *path = NULL;
char *prefix_end = NULL;
@@ -1534,8 +1534,8 @@ char *torture_create_temp_file(const char *template)
*prefix_end = '\0';
}
- rc = GetTempPathA(MAX_PATH, tmp_dir_path);
- if ((rc > MAX_PATH) || (rc == 0)) {
+ rc = GetTempPathA(PATH_MAX, tmp_dir_path);
+ if ((rc > PATH_MAX) || (rc == 0)) {
goto free_prefix;
}