qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/6] qga: create state directory on win32
Date: Sat, 18 May 2013 06:31:51 +0200	[thread overview]
Message-ID: <1368851513-20550-5-git-send-email-lersek@redhat.com> (raw)
In-Reply-To: <1368851513-20550-1-git-send-email-lersek@redhat.com>

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>
---
 qga/main.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

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.1

  parent reply	other threads:[~2013-05-18  4:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-18  4:31 [Qemu-devel] [PATCH 0/6] local state directory fixes for win32 qga Laszlo Ersek
2013-05-18  4:31 ` [Qemu-devel] [PATCH 1/6] osdep: add qemu_get_local_state_pathname() Laszlo Ersek
2013-05-18  4:31 ` [Qemu-devel] [PATCH 2/6] qga: determine default state dir and pidfile dynamically Laszlo Ersek
2013-05-18  4:31 ` [Qemu-devel] [PATCH 3/6] configure: don't save any fixed local_statedir for win32 Laszlo Ersek
2013-05-18  4:31 ` Laszlo Ersek [this message]
2013-05-18  4:31 ` [Qemu-devel] [PATCH 5/6] qga: remove undefined behavior in ga_install_service() Laszlo Ersek
2013-05-18  4:31 ` [Qemu-devel] [PATCH 6/6] qga: save state directory " Laszlo Ersek
2013-05-18  5:13 ` [Qemu-devel] [PATCH 7/6] Makefile: create ".../var/run" when installing the POSIX guest agent Laszlo Ersek
2013-05-20 16:15 ` [Qemu-devel] [PATCH 0/6] local state directory fixes for win32 qga mdroth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368851513-20550-5-git-send-email-lersek@redhat.com \
    --to=lersek@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).