# DP: Replace PATH_MAX with MAXPATHLEN. --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -680,7 +680,7 @@ } static wchar_t *default_home = NULL; -static wchar_t env_home[PATH_MAX+1]; +static wchar_t env_home[MAXPATHLEN+1]; void Py_SetPythonHome(wchar_t *home) @@ -695,8 +695,8 @@ if (home == NULL && !Py_IgnoreEnvironmentFlag) { char* chome = Py_GETENV("PYTHONHOME"); if (chome) { - size_t r = mbstowcs(env_home, chome, PATH_MAX+1); - if (r != (size_t)-1 && r <= PATH_MAX) + size_t r = mbstowcs(env_home, chome, MAXPATHLEN+1); + if (r != (size_t)-1 && r <= MAXPATHLEN) home = env_home; } --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1804,7 +1804,7 @@ #else /* All other filename syntaxes */ if (_HAVE_SCRIPT_ARGUMENT(argc, argv)) { #if defined(HAVE_REALPATH) - if (_Py_wrealpath(argv0, fullpath, PATH_MAX)) { + if (_Py_wrealpath(argv0, fullpath, MAXPATHLEN)) { argv0 = fullpath; } #endif --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -1,4 +1,5 @@ #include "Python.h" +#include "osdefs.h" #ifdef MS_WINDOWS # include #endif @@ -325,7 +326,7 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) { char *cpath; - char cbuf[PATH_MAX]; + char cbuf[MAXPATHLEN]; wchar_t *wbuf; int res; size_t r1; @@ -335,11 +336,11 @@ errno = EINVAL; return -1; } - res = (int)readlink(cpath, cbuf, PATH_MAX); + res = (int)readlink(cpath, cbuf, MAXPATHLEN); PyMem_Free(cpath); if (res == -1) return -1; - if (res == PATH_MAX) { + if (res == MAXPATHLEN) { errno = EINVAL; return -1; } @@ -370,7 +371,7 @@ wchar_t *resolved_path, size_t resolved_path_size) { char *cpath; - char cresolved_path[PATH_MAX]; + char cresolved_path[MAXPATHLEN]; wchar_t *wresolved_path; char *res; size_t r; @@ -409,11 +410,11 @@ #ifdef MS_WINDOWS return _wgetcwd(buf, size); #else - char fname[PATH_MAX]; + char fname[MAXPATHLEN]; wchar_t *wname; size_t len; - if (getcwd(fname, PATH_MAX) == NULL) + if (getcwd(fname, MAXPATHLEN) == NULL) return NULL; wname = _Py_char2wchar(fname, &len); if (wname == NULL)