aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/Unix/PathV2.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Unix/PathV2.inc')
-rw-r--r--lib/Support/Unix/PathV2.inc10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc
index 7d79947..7d259a3 100644
--- a/lib/Support/Unix/PathV2.inc
+++ b/lib/Support/Unix/PathV2.inc
@@ -46,6 +46,11 @@
#include <limits.h>
#endif
+// For GNU Hurd
+#if defined(__GNU__) && !defined(PATH_MAX)
+# define PATH_MAX 4096
+#endif
+
extern "C" int truncate (const char*, off_t);
using namespace llvm;
@@ -98,7 +103,12 @@ namespace sys {
namespace fs {
error_code current_path(SmallVectorImpl<char> &result) {
+#ifdef MAXPATHLEN
result.reserve(MAXPATHLEN);
+#else
+// For GNU Hurd
+ result.reserve(1024);
+#endif
while (true) {
if (::getcwd(result.data(), result.capacity()) == 0) {