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 <penberg@kernel.org>
This commit is contained in:
Pekka Enberg
2015-06-01 16:39:48 +01:00
committed by Will Deacon
parent fa0022d276
commit 2bc995fbc0
+2
View File
@@ -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");
}