From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zml2P-0000JX-Jd for qemu-devel@nongnu.org; Thu, 15 Oct 2015 12:05:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zml2L-00010K-3f for qemu-devel@nongnu.org; Thu, 15 Oct 2015 12:05:53 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:35078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zml2K-000101-Mc for qemu-devel@nongnu.org; Thu, 15 Oct 2015 12:05:48 -0400 Received: from localhost by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 Oct 2015 10:05:48 -0600 Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 48BE76E8045 for ; Thu, 15 Oct 2015 11:53:57 -0400 (EDT) Received: from d01av05.pok.ibm.com (d01av05.pok.ibm.com [9.56.224.195]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9FG5jhe57802908 for ; Thu, 15 Oct 2015 16:05:45 GMT Received: from d01av05.pok.ibm.com (localhost [127.0.0.1]) by d01av05.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9FG5Icb025599 for ; Thu, 15 Oct 2015 12:05:20 -0400 From: Michael Roth Date: Thu, 15 Oct 2015 11:05:09 -0500 Message-Id: <1444925118-10629-4-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1444925118-10629-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1444925118-10629-1-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 03/12] qga: add QGA_CONF environment variable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Michael Roth , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-André Lureau Having a environment variable allows to override default configuration path, useful for testing. Note that this can't easily be an argument, since loading config is done before parsing the arguments. Signed-off-by: Marc-André Lureau Reviewed-by: Michael Roth Signed-off-by: Michael Roth --- qga/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qga/main.c b/qga/main.c index d8e063a..18e1e1d 100644 --- a/qga/main.c +++ b/qga/main.c @@ -945,10 +945,11 @@ static void config_load(GAConfig *config) { GError *gerr = NULL; GKeyFile *keyfile; + const char *conf = g_getenv("QGA_CONF") ?: QGA_CONF_DEFAULT; /* read system config */ keyfile = g_key_file_new(); - if (!g_key_file_load_from_file(keyfile, QGA_CONF_DEFAULT, 0, &gerr)) { + if (!g_key_file_load_from_file(keyfile, conf, 0, &gerr)) { goto end; } if (g_key_file_has_key(keyfile, "general", "daemon", NULL)) { -- 1.9.1