From 2bc995fbc0ba33821527d78b51746c24ccd79e44 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 --- kvm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kvm.c b/kvm.c index f470c17..c929757 100644 --- a/kvm.c +++ b/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"); }