From 1c6fc0a5f82b9dca8828e623c82cc6eb6648d670 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Thu, 8 Mar 2012 14:37:37 +0200 Subject: [PATCH] kvm tools, sandbox: Fix running guest commands This patch fixes "vm sandbox" for guest commands that are not on host filesytem. Signed-off-by: Pekka Enberg --- tools/kvm/builtin-run.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c index ff53e7260581..c8ae2f537054 100644 --- a/tools/kvm/builtin-run.c +++ b/tools/kvm/builtin-run.c @@ -850,11 +850,11 @@ static void kvm_write_sandbox_cmd_exactly(int fd, const char *arg) static void resolve_program(const char *src, char *dst, size_t len) { struct stat st; + int err; - if (stat(src, &st) < 0) - die("Unable to resolve program %s: %s", src, strerror(errno)); + err = stat(src, &st); - if (S_ISREG(st.st_mode)) { + if (!err && S_ISREG(st.st_mode)) { char resolved_path[PATH_MAX]; realpath(src, resolved_path); -- 2.39.5