From 6e02a8277a73d40570fd8cdac2f7997c52a9c169 Mon Sep 17 00:00:00 2001 From: Hagen Paul Pfeifer Date: Thu, 25 Aug 2011 00:26:23 +0200 Subject: [PATCH] kvm tools, setup: Create private directory If ~/.kvm-tools is not already created all successive mkdir calls will fail. Fix this by create the directory explicitly. Signed-off-by: Hagen Paul Pfeifer Signed-off-by: Pekka Enberg --- tools/kvm/builtin-setup.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/kvm/builtin-setup.c b/tools/kvm/builtin-setup.c index 1bbdd234ab2..75874760eb0 100644 --- a/tools/kvm/builtin-setup.c +++ b/tools/kvm/builtin-setup.c @@ -141,6 +141,15 @@ static int make_guestfs_symlink(const char *guestfs_name, const char *path) return symlink(target, name); } +static void make_root_dir(void) +{ + char name[PATH_MAX]; + + snprintf(name, PATH_MAX, "%s%s", HOME_DIR, KVM_PID_FILE_PATH); + + mkdir(name, 0777); +} + static void make_dir(const char *dir) { char name[PATH_MAX]; @@ -163,6 +172,8 @@ static int do_setup(const char *guestfs_name) { unsigned int i; + make_root_dir(); + make_dir(guestfs_name); for (i = 0; i < ARRAY_SIZE(guestfs_dirs); i++) -- 2.11.4.GIT