[Python-checkins] cpython (3.3): fileutils.c: use MAXPATHLEN instead of PATH_MAX
victor.stinner
python-checkins at python.org
Fri Nov 15 18:14:53 CET 2013
http://hg.python.org/cpython/rev/8bbd215940f1
changeset: 87117:8bbd215940f1
branch: 3.3
parent: 87115:780a0199c7f1
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri Nov 15 18:14:11 2013 +0100
summary:
fileutils.c: use MAXPATHLEN instead of PATH_MAX
PATH_MAX is not declared on IRIX nor Windows.
files:
Python/fileutils.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Python/fileutils.c b/Python/fileutils.c
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -623,7 +623,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;
@@ -633,11 +633,11 @@
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;
}
@@ -669,7 +669,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;
@@ -709,11 +709,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, Py_ARRAY_LENGTH(fname)) == NULL)
return NULL;
wname = _Py_char2wchar(fname, &len);
if (wname == NULL)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list