cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 7f69c4a541318610bef76295163cf4d7907d2339 Mon Sep 17 00:00:00 2001
9ae3a8
From: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Date: Wed, 31 Jul 2013 14:03:25 +0200
9ae3a8
Subject: [PATCH 04/28] qga: create state directory on win32
9ae3a8
9ae3a8
RH-Author: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Message-id: <1375279407-13573-5-git-send-email-lersek@redhat.com>
9ae3a8
Patchwork-id: 52867
9ae3a8
O-Subject: [RHEL-7 qemu-kvm PATCH 4/6] qga: create state directory on win32
9ae3a8
Bugzilla: 964304
9ae3a8
RH-Acked-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
On Win32 the local state directory is application specific and users might
9ae3a8
expect qemu-ga to create it automatically.
9ae3a8
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
9ae3a8
(cherry picked from commit bf12c1fa8c78e3c667f2fe2ecc656f4f3cfb914e)
9ae3a8
---
9ae3a8
 qga/main.c |   14 ++++++++++++++
9ae3a8
 1 files changed, 14 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 qga/main.c |   14 ++++++++++++++
9ae3a8
 1 files changed, 14 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/qga/main.c b/qga/main.c
9ae3a8
index 050b968..e49a6dd 100644
9ae3a8
--- a/qga/main.c
9ae3a8
+++ b/qga/main.c
9ae3a8
@@ -1042,6 +1042,20 @@ int main(int argc, char **argv)
9ae3a8
         }
9ae3a8
     }
9ae3a8
 
9ae3a8
+#ifdef _WIN32
9ae3a8
+    /* On win32 the state directory is application specific (be it the default
9ae3a8
+     * or a user override). We got past the command line parsing; let's create
9ae3a8
+     * the directory (with any intermediate directories). If we run into an
9ae3a8
+     * error later on, we won't try to clean up the directory, it is considered
9ae3a8
+     * persistent.
9ae3a8
+     */
9ae3a8
+    if (g_mkdir_with_parents(state_dir, S_IRWXU) == -1) {
9ae3a8
+        g_critical("unable to create (an ancestor of) the state directory"
9ae3a8
+                   " '%s': %s", state_dir, strerror(errno));
9ae3a8
+        return EXIT_FAILURE;
9ae3a8
+    }
9ae3a8
+#endif
9ae3a8
+
9ae3a8
     s = g_malloc0(sizeof(GAState));
9ae3a8
     s->log_level = log_level;
9ae3a8
     s->log_file = stderr;
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8