From patchwork Thu May 30 18:58:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 247675 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id ADD052C00A7 for ; Fri, 31 May 2013 05:06:26 +1000 (EST) Received: from localhost ([::1]:52664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui8B6-0004Up-I9 for incoming@patchwork.ozlabs.org; Thu, 30 May 2013 15:06:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui8Am-0004TB-C9 for qemu-devel@nongnu.org; Thu, 30 May 2013 15:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ui85T-0007d4-Dx for qemu-devel@nongnu.org; Thu, 30 May 2013 15:00:46 -0400 Received: from mail-qa0-x230.google.com ([2607:f8b0:400d:c00::230]:63397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui85T-0007cs-Aj for qemu-devel@nongnu.org; Thu, 30 May 2013 15:00:35 -0400 Received: by mail-qa0-f48.google.com with SMTP id ih17so8955qab.7 for ; Thu, 30 May 2013 12:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=FenbMStVjoiAyzH4M7E1VFU2Q0QA0Gf8kpEIkd6ZWsU=; b=eMDx0TUn4fQhWMKLw6Tz8Xo8X7I7B0XqPhLLje2cAtjYg6KuFutWs9O6l1CntSipyB u9od2PbhobntSuc4Ok21pMLYZUWLN6uxlSclMlyBMFbjHGueqaeYr11e4fY6v5q4qIcA DKD0qch75SSeQuJY1j9fuG24SwBQvNVbydWrJIWyNmBMkMMaxKAFjLsK8YXtLIR0g7iK 9lx/OExyMtEPSTEy0ERajoO+4W7FI/AJTkffPd8xGhwzq0pFCwhy51Km6WnWqEy71WH9 su63YXDkw6Zs4pOiXaKmUIcSJUt6B+T1Iu1QBHuqps1yaTBoUTnHp+c+eAysRu/tasod n1GA== X-Received: by 10.229.155.201 with SMTP id t9mr2725409qcw.155.1369940434863; Thu, 30 May 2013 12:00:34 -0700 (PDT) Received: from localhost ([32.97.110.51]) by mx.google.com with ESMTPSA id j9sm38267645qas.3.2013.05.30.12.00.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 12:00:34 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 30 May 2013 13:58:58 -0500 Message-Id: <1369940341-9043-5-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1369940341-9043-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1369940341-9043-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c00::230 Cc: aliguori@us.ibm.com, lersek@redhat.com Subject: [Qemu-devel] [PATCH 4/7] 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 From: Laszlo Ersek On Win32 the local state directory is application specific and users might expect qemu-ga to create it automatically. Signed-off-by: Laszlo Ersek Signed-off-by: Michael Roth --- 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;