~ubuntu-branches/ubuntu/trusty/python3.3/trusty

« back to all changes in this revision

Viewing changes to debian/patches/hurd-path_max.diff

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-11-23 08:57:21 UTC
  • mfrom: (22.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20131123085721-h82pot5c745ijhel
Tags: 3.3.3-2
* Update to 20131123 from the 3.3 branch.
* Update hurd-path_max.diff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# DP: Replace PATH_MAX with MAXPATHLEN.
2
 
 
3
1
--- a/Python/pythonrun.c
4
2
+++ b/Python/pythonrun.c
5
 
@@ -680,7 +680,7 @@
6
 
 }
7
 
 
8
 
 static wchar_t *default_home = NULL;
9
 
-static wchar_t env_home[PATH_MAX+1];
10
 
+static wchar_t env_home[MAXPATHLEN+1];
11
 
 
12
 
 void
13
 
 Py_SetPythonHome(wchar_t *home)
14
 
@@ -695,8 +695,8 @@
15
 
     if (home == NULL && !Py_IgnoreEnvironmentFlag) {
16
 
         char* chome = Py_GETENV("PYTHONHOME");
17
 
         if (chome) {
18
 
-            size_t r = mbstowcs(env_home, chome, PATH_MAX+1);
19
 
-            if (r != (size_t)-1 && r <= PATH_MAX)
20
 
+            size_t r = mbstowcs(env_home, chome, MAXPATHLEN+1);
21
 
+            if (r != (size_t)-1 && r <= MAXPATHLEN)
22
 
                 home = env_home;
23
 
         }
24
 
 
25
 
--- a/Python/sysmodule.c
26
 
+++ b/Python/sysmodule.c
27
 
@@ -1804,7 +1804,7 @@
28
 
 #else /* All other filename syntaxes */
29
 
     if (_HAVE_SCRIPT_ARGUMENT(argc, argv)) {
30
 
 #if defined(HAVE_REALPATH)
31
 
-        if (_Py_wrealpath(argv0, fullpath, PATH_MAX)) {
32
 
+        if (_Py_wrealpath(argv0, fullpath, MAXPATHLEN)) {
33
 
             argv0 = fullpath;
34
 
         }
 
3
@@ -35,6 +35,10 @@
 
4
 #define PATH_MAX MAXPATHLEN
35
5
 #endif
36
 
--- a/Python/fileutils.c
37
 
+++ b/Python/fileutils.c
38
 
@@ -325,7 +326,7 @@
39
 
 _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz)
40
 
 {
41
 
     char *cpath;
42
 
-    char cbuf[PATH_MAX];
43
 
+    char cbuf[MAXPATHLEN];
44
 
     wchar_t *wbuf;
45
 
     int res;
46
 
     size_t r1;
47
 
@@ -335,11 +336,11 @@
48
 
         errno = EINVAL;
49
 
         return -1;
50
 
     }
51
 
-    res = (int)readlink(cpath, cbuf, PATH_MAX);
52
 
+    res = (int)readlink(cpath, cbuf, MAXPATHLEN);
53
 
     PyMem_Free(cpath);
54
 
     if (res == -1)
55
 
         return -1;
56
 
-    if (res == PATH_MAX) {
57
 
+    if (res == MAXPATHLEN) {
58
 
         errno = EINVAL;
59
 
         return -1;
60
 
     }
61
 
@@ -370,7 +371,7 @@
62
 
               wchar_t *resolved_path, size_t resolved_path_size)
63
 
 {
64
 
     char *cpath;
65
 
-    char cresolved_path[PATH_MAX];
66
 
+    char cresolved_path[MAXPATHLEN];
67
 
     wchar_t *wresolved_path;
68
 
     char *res;
69
 
     size_t r;
70
 
@@ -409,11 +410,11 @@
71
 
 #ifdef MS_WINDOWS
72
 
     return _wgetcwd(buf, size);
73
 
 #else
74
 
-    char fname[PATH_MAX];
75
 
+    char fname[MAXPATHLEN];
76
 
     wchar_t *wname;
77
 
     size_t len;
78
6
 
79
 
-    if (getcwd(fname, PATH_MAX) == NULL)
80
 
+    if (getcwd(fname, MAXPATHLEN) == NULL)
81
 
         return NULL;
82
 
     wname = _Py_char2wchar(fname, &len);
83
 
     if (wname == NULL)
 
7
+#ifdef __gnu_hurd__
 
8
+#define PATH_MAX MAXPATHLEN
 
9
+#endif
 
10
+
 
11
 #ifndef Py_REF_DEBUG
 
12
 #define PRINT_TOTAL_REFS()
 
13
 #else /* Py_REF_DEBUG */