Don't try to enforce MAXPATHLEN in sys::Path for Unix. OS's can check
authorDan Gohman <gohman@apple.com>
Tue, 2 Nov 2010 23:19:55 +0000 (23:19 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 2 Nov 2010 23:19:55 +0000 (23:19 +0000)
limits on their own.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118113 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Unix/Path.inc

index b7afb8536d5e1fcf53be75cfd8f6b8f4203a505a..c90092001e30fef804aed1f4930e9a210937c9c9 100644 (file)
@@ -96,10 +96,12 @@ Path::operator=(StringRef that) {
 
 bool
 Path::isValid() const {
-  // Check some obvious things
-  if (path.empty())
-    return false;
-  return path.length() < MAXPATHLEN;
+  // Empty paths are considered invalid here.
+  // This code doesn't check MAXPATHLEN because there's no need. Nothing in
+  // LLVM manipulates Paths with fixed-sizes arrays, and if the OS can't
+  // handle names longer than some limit, it'll report this on demand using
+  // ENAMETOLONG.
+  return !path.empty();
 }
 
 bool