From patchwork Sat May 18 04:31:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 244736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5EA392C009D for ; Sat, 18 May 2013 14:32:47 +1000 (EST) Received: from localhost ([::1]:59836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdYp3-0008GD-J9 for incoming@patchwork.ozlabs.org; Sat, 18 May 2013 00:32:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdYmb-0004H4-TA for qemu-devel@nongnu.org; Sat, 18 May 2013 00:30:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdYmZ-0002cV-Km for qemu-devel@nongnu.org; Sat, 18 May 2013 00:30:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdYmZ-0002cC-5W for qemu-devel@nongnu.org; Sat, 18 May 2013 00:30:11 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4I4Tec2022407 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 18 May 2013 00:29:40 -0400 Received: from lacos-laptop.usersys.redhat.com (vpn1-5-212.ams2.redhat.com [10.36.5.212]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4I4TXCq014174; Sat, 18 May 2013 00:29:39 -0400 From: Laszlo Ersek To: mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org Date: Sat, 18 May 2013 06:31:51 +0200 Message-Id: <1368851513-20550-5-git-send-email-lersek@redhat.com> In-Reply-To: <1368851513-20550-1-git-send-email-lersek@redhat.com> References: <1368851513-20550-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 4/6] qga: create state directory on win32 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Win32 the local state directory is application specific and users might expect qemu-ga to create it automatically. Signed-off-by: Laszlo Ersek --- 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;