From cb74799f8ce056e95ce1e7a514846fedc515424d Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Tue, 25 Oct 2011 23:53:14 +0300 Subject: [PATCH] kvm tools: Fix 'kvm run' when run the first time The realpath() function returns NULL if directory does not exists. This patch changes kvm__set_dir() to call mkdir() to make sure the directory is there. This fixes 'kvm run' breakage when run the very first time. Signed-off-by: Pekka Enberg --- tools/kvm/kvm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index f470c1707b4c..c9297577569e 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -90,6 +90,8 @@ static void set_dir(const char *fmt, va_list args) vsnprintf(tmp, sizeof(tmp), fmt, args); + mkdir(tmp, 0777); + if (!realpath(tmp, kvm_dir)) die("Unable to set KVM tool directory"); } -- 2.39.5