aboutsummaryrefslogtreecommitdiffstats
path: root/vl.c
diff options
context:
space:
mode:
authorJean-Christophe DUBOIS <jcd@tribudubois.net>2009-09-02 23:59:02 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-09-09 14:57:21 -0500
commit4d224196614a005b519682b3eaff312ec71b5b97 (patch)
treebdc89aefc9337026d292694f8f423c4f6071815f /vl.c
parentd6fd1e660312f96e6b5ca708b07a58df725ca055 (diff)
fix PATH_MAX conditional compilation
PATH_MAX is used elsewhere in the qemu source tree without protection. In addtion the actual code would not compile if PATH_MAX is not defined Last the free() call is wrong as p is not malloc()ed. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/vl.c b/vl.c
index 215132a55..6d535b91e 100644
--- a/vl.c
+++ b/vl.c
@@ -4625,9 +4625,7 @@ static char *find_datadir(const char *argv0)
char *dir;
char *p = NULL;
char *res;
-#ifdef PATH_MAX
char buf[PATH_MAX];
-#endif
size_t max_len;
#if defined(__linux__)
@@ -4652,10 +4650,7 @@ static char *find_datadir(const char *argv0)
/* If we don't have any way of figuring out the actual executable
location then try argv[0]. */
if (!p) {
-#ifdef PATH_MAX
- p = buf;
-#endif
- p = realpath(argv0, p);
+ p = realpath(argv0, buf);
if (!p) {
return NULL;
}
@@ -4674,9 +4669,7 @@ static char *find_datadir(const char *argv0)
res = NULL;
}
}
-#ifndef PATH_MAX
- free(p);
-#endif
+
return res;
}
#undef SHARE_SUFFIX