qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] fix PATH_MAX conditional compilation


From: Jean-Christophe DUBOIS
Subject: [Qemu-devel] [PATCH] fix PATH_MAX conditional compilation
Date: Wed, 2 Sep 2009 23:59:02 +0200

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 <address@hidden>
---
 vl.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/vl.c b/vl.c
index a894285..1bdc586 100644
--- a/vl.c
+++ b/vl.c
@@ -4703,9 +4703,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__)
@@ -4730,10 +4728,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;
         }
@@ -4752,9 +4747,7 @@ static char *find_datadir(const char *argv0)
             res = NULL;
         }
     }
-#ifndef PATH_MAX
-    free(p);
-#endif
+
     return res;
 }
 #undef SHARE_SUFFIX
-- 
1.6.0.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]