diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-15 17:14:33 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-15 17:14:33 (GMT) |
commit | c31ebb60f975b231e8f2fff7af72204bf3309ed0 (patch) | |
tree | fc2cc1d452513dbcefa7eeccb24f5d049f790d7c /Python | |
parent | 50e01570138109584c7f028554eddac7931197fe (diff) | |
parent | b11d6cb711cb9b14d3580581d61bec224042feb5 (diff) | |
download | cpython-c31ebb60f975b231e8f2fff7af72204bf3309ed0.zip cpython-c31ebb60f975b231e8f2fff7af72204bf3309ed0.tar.gz cpython-c31ebb60f975b231e8f2fff7af72204bf3309ed0.tar.bz2 |
(Merge 3.3) fileutils.c: use MAXPATHLEN instead of PATH_MAX
PATH_MAX is not declared on IRIX nor Windows.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/fileutils.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c index b504b15..814f076 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -869,7 +869,7 @@ int _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; @@ -879,11 +879,11 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) errno = EINVAL; return -1; } - res = (int)readlink(cpath, cbuf, PATH_MAX); + res = (int)readlink(cpath, cbuf, Py_ARRAY_LENGTH(cbuf)); PyMem_Free(cpath); if (res == -1) return -1; - if (res == PATH_MAX) { + if (res == Py_ARRAY_LENGTH(cbuf)) { errno = EINVAL; return -1; } @@ -915,7 +915,7 @@ _Py_wrealpath(const wchar_t *path, 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; @@ -956,11 +956,11 @@ _Py_wgetcwd(wchar_t *buf, size_t size) int isize = (int)Py_MIN(size, INT_MAX); return _wgetcwd(buf, isize); #else - char fname[PATH_MAX]; + char fname[MAXPATHLEN]; wchar_t *wname; size_t len; - if (getcwd(fname, PATH_MAX) == NULL) + if (getcwd(fname, Py_ARRAY_LENGTH(fname)) == NULL) return NULL; wname = _Py_char2wchar(fname, &len); if (wname == NULL) |