[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/7] qga: create state directory on win32
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 4/7] qga: create state directory on win32 |
Date: |
Thu, 30 May 2013 13:58:58 -0500 |
From: Laszlo Ersek <address@hidden>
On Win32 the local state directory is application specific and users might
expect qemu-ga to create it automatically.
Signed-off-by: Laszlo Ersek <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
---
qga/main.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/qga/main.c b/qga/main.c
index f5f033d..5f2d141 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;
--
1.7.9.5
- [Qemu-devel] [PULL 0/7] qemu-ga: local state directory fixes for win32, Michael Roth, 2013/05/30
- [Qemu-devel] [PATCH 3/7] configure: don't save any fixed local_statedir for win32, Michael Roth, 2013/05/30
- [Qemu-devel] [PATCH 2/7] qga: determine default state dir and pidfile dynamically, Michael Roth, 2013/05/30
- [Qemu-devel] [PATCH 1/7] osdep: add qemu_get_local_state_pathname(), Michael Roth, 2013/05/30
- [Qemu-devel] [PATCH 6/7] qga: save state directory in ga_install_service(), Michael Roth, 2013/05/30
- [Qemu-devel] [PATCH 5/7] qga: remove undefined behavior in ga_install_service(), Michael Roth, 2013/05/30
- [Qemu-devel] [PATCH 7/7] Makefile: create ".../var/run" when installing the POSIX guest agent, Michael Roth, 2013/05/30
- [Qemu-devel] [PATCH 4/7] qga: create state directory on win32,
Michael Roth <=