about summary refs log tree commit diff homepage
path: root/runtime/POSIX/stubs.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/POSIX/stubs.c')
-rw-r--r--runtime/POSIX/stubs.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/runtime/POSIX/stubs.c b/runtime/POSIX/stubs.c
index 7a424d05..1a6ee12b 100644
--- a/runtime/POSIX/stubs.c
+++ b/runtime/POSIX/stubs.c
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#define _XOPEN_SOURCE 700
+
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
@@ -252,11 +254,7 @@ unsigned long long int gnu_dev_makedev(unsigned int __major, unsigned int __mino
 
 char *canonicalize_file_name (const char *name) __attribute__((weak));
 char *canonicalize_file_name (const char *name) {
-  char *res = malloc(PATH_MAX);
-  char *rp_res = realpath(name, res);
-  if (!rp_res)
-    free(res);
-  return rp_res;
+  return realpath(name, NULL);
 }
 
 int getloadavg(double loadavg[], int nelem) __attribute__((weak));