From: Pekka Enberg Date: Tue, 25 Oct 2011 20:53:14 +0000 (+0300) Subject: kvm tools: Fix 'kvm run' when run the first time X-Git-Tag: next-20111101~5^2~12 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cb74799f8ce056e95ce1e7a514846fedc515424d;p=karo-tx-linux.git 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 --- 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"); }