File: path_max.patch

package info (click to toggle)
crunch-dxtc 0.55.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,624 kB
  • sloc: cpp: 64,979; ansic: 633; python: 321; makefile: 116
file content (34 lines) | stat: -rw-r--r-- 911 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Description: fix for platforms that don't define PATH_MAX
Author: Sébastien Noel <sebastien@twolife.be>
Forwarded: TODO
--- a/crnlib/crn_file_utils.cpp
+++ b/crnlib/crn_file_utils.cpp
@@ -347,23 +347,23 @@ bool file_utils::full_path(dynamic_string& path) {
   if (!p)
     return false;
 #else
-  char buf[PATH_MAX];
   char* p;
   dynamic_string pn, fn;
   split_path(path.get_ptr(), pn, fn);
   if ((fn == ".") || (fn == "..")) {
-    p = realpath(path.get_ptr(), buf);
+    p = realpath(path.get_ptr(), NULL);
     if (!p)
       return false;
-    path.set(buf);
+    path.set(p);
   } else {
     if (pn.is_empty())
       pn = "./";
-    p = realpath(pn.get_ptr(), buf);
+    p = realpath(pn.get_ptr(), NULL);
     if (!p)
       return false;
-    combine_path(path, buf, fn.get_ptr());
+    combine_path(path, p, fn.get_ptr());
   }
+  free(p);
 #endif
 
   return true;