]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Fix 'kvm run' when run the first time
authorPekka Enberg <penberg@kernel.org>
Tue, 25 Oct 2011 20:53:14 +0000 (23:53 +0300)
committerPekka Enberg <penberg@kernel.org>
Tue, 25 Oct 2011 20:53:14 +0000 (23:53 +0300)
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>
tools/kvm/kvm.c

index f470c1707b4c39191b1bc21eb95e8976f9824896..c9297577569ef05b10968cdd1f743cb0e59b381f 100644 (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");
 }