about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2013-10-18 13:33:06 +0200
committerFrank Busse <bb0xfb@gmail.com>2013-10-18 14:19:49 +0200
commit3e53a26e31b30d65ddaffd94a792b5efdb154729 (patch)
treee07468811b555ebc216b0da35383e2c8beb7a4a1
parenta07ac98574e93f196b3bfdacaceceb4b5a806e13 (diff)
downloadklee-3e53a26e31b30d65ddaffd94a792b5efdb154729.tar.gz
stubs.c: fix use of undeclared identifier PATH_MAX
-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));