aboutsummaryrefslogtreecommitdiff
path: root/qga
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2013-05-18 06:31:51 +0200
committerMichael Roth <mdroth@linux.vnet.ibm.com>2013-05-30 11:37:37 -0500
commitbf12c1fa8c78e3c667f2fe2ecc656f4f3cfb914e (patch)
tree0c6e09ffcf76dc9651c4fc11e0713adc3e9f0047 /qga
parent5a699bbbf300902141d2458682d05cd310d7a07f (diff)
qga: create state directory on win32
On Win32 the local state directory is application specific and users might expect qemu-ga to create it automatically. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga')
-rw-r--r--qga/main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/qga/main.c b/qga/main.c
index f5f033d151..5f2d141431 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -1041,6 +1041,20 @@ int main(int argc, char **argv)
}
}
+#ifdef _WIN32
+ /* On win32 the state directory is application specific (be it the default
+ * or a user override). We got past the command line parsing; let's create
+ * the directory (with any intermediate directories). If we run into an
+ * error later on, we won't try to clean up the directory, it is considered
+ * persistent.
+ */
+ if (g_mkdir_with_parents(state_dir, S_IRWXU) == -1) {
+ g_critical("unable to create (an ancestor of) the state directory"
+ " '%s': %s", state_dir, strerror(errno));
+ return EXIT_FAILURE;
+ }
+#endif
+
s = g_malloc0(sizeof(GAState));
s->log_level = log_level;
s->log_file = stderr;