]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Fix realpath() error checking
authorPekka Enberg <penberg@kernel.org>
Fri, 9 Mar 2012 07:52:15 +0000 (09:52 +0200)
committerPekka Enberg <penberg@kernel.org>
Fri, 9 Mar 2012 07:52:15 +0000 (09:52 +0200)
The realpath() function can fail, so check for errors to fix up compilation
with "-Werror".

Reported-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/builtin-run.c

index c8ae2f537054d4b71cea7b4427636475e51627b0..33be3bd636cce09efc49b854a7344bd3a096433a 100644 (file)
@@ -857,7 +857,8 @@ static void resolve_program(const char *src, char *dst, size_t len)
        if (!err && S_ISREG(st.st_mode)) {
                char resolved_path[PATH_MAX];
 
-               realpath(src, resolved_path);
+               if (!realpath(src, resolved_path))
+                       die("Unable to resolve program %s: %s\n", src, strerror(errno));
 
                snprintf(dst, len, "/host%s", resolved_path);
        } else