From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhlWm-0002DN-H5 for qemu-devel@nongnu.org; Thu, 01 Oct 2015 17:36:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhlWh-0004qK-IJ for qemu-devel@nongnu.org; Thu, 01 Oct 2015 17:36:36 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:36616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhlWh-0004os-An for qemu-devel@nongnu.org; Thu, 01 Oct 2015 17:36:31 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Oct 2015 15:36:28 -0600 Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 427AB19D8048 for ; Thu, 1 Oct 2015 15:24:39 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t91LaQXK65077382 for ; Thu, 1 Oct 2015 14:36:26 -0700 Received: from d03av03.boulder.ibm.com (localhost [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t91LaQ7R012329 for ; Thu, 1 Oct 2015 15:36:26 -0600 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1441997621-3284-2-git-send-email-marcandre.lureau@redhat.com> References: <1441997621-3284-1-git-send-email-marcandre.lureau@redhat.com> <1441997621-3284-2-git-send-email-marcandre.lureau@redhat.com> Message-ID: <20151001202748.32707.78321@loki> Date: Thu, 01 Oct 2015 15:27:48 -0500 Subject: Re: [Qemu-devel] [PATCH v2 1/4] qga: add QGA_CONF environment variable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org Quoting marcandre.lureau@redhat.com (2015-09-11 13:53:38) > From: Marc-Andr=C3=A9 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. I'd rather this be fixed by adding a config_parse_early() prior config_load() to handle a command-line specification of config file path, but I don't object to an environment variable to specify it in lieu of that so: > = > Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-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 =3D NULL; > GKeyFile *keyfile; > + const char *conf =3D g_getenv("QGA_CONF") ?: QGA_CONF_DEFAULT; > = > /* read system config */ > keyfile =3D 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)) { > -- = > 2.4.3 >=20