From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaTSJ-0003rY-Bh for qemu-devel@nongnu.org; Fri, 11 Sep 2015 14:53:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaTSI-00078y-ES for qemu-devel@nongnu.org; Fri, 11 Sep 2015 14:53:51 -0400 Received: from mail-qg0-x22e.google.com ([2607:f8b0:400d:c04::22e]:34563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaTSI-00078h-Av for qemu-devel@nongnu.org; Fri, 11 Sep 2015 14:53:50 -0400 Received: by qgez77 with SMTP id z77so70625234qge.1 for ; Fri, 11 Sep 2015 11:53:50 -0700 (PDT) Sender: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= From: marcandre.lureau@redhat.com Date: Fri, 11 Sep 2015 20:53:38 +0200 Message-Id: <1441997621-3284-2-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1441997621-3284-1-git-send-email-marcandre.lureau@redhat.com> References: <1441997621-3284-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [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: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mdroth@linux.vnet.ibm.com 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 --- 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)) { -- 2.4.3