From patchwork Fri Oct 2 12:58:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 525535 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B96A5140D89 for ; Fri, 2 Oct 2015 23:46:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Xea0WB8D; dkim-atps=neutral Received: from localhost ([::1]:59883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi0fF-00049G-De for incoming@patchwork.ozlabs.org; Fri, 02 Oct 2015 09:46:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhzuq-0001Nl-UN for qemu-devel@nongnu.org; Fri, 02 Oct 2015 08:58:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zhzuq-00075F-26 for qemu-devel@nongnu.org; Fri, 02 Oct 2015 08:58:24 -0400 Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:36522) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhzup-00074j-Un for qemu-devel@nongnu.org; Fri, 02 Oct 2015 08:58:23 -0400 Received: by qkcf65 with SMTP id f65so42116884qkc.3 for ; Fri, 02 Oct 2015 05:58:23 -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:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=WnncWiRAD0o1SJgnSVlJyv38WYzk3KbCNywYmTzI5Pw=; b=Xea0WB8DwR2rV/eNRT0b956JftXT6GBKiccIeGDbOLH21NCnfe4HcDaRIAFXQjtxkd 3V8wAPt0Yk54gJCC6botxaAta82bSE7pPVXXaELX71sn1DWFBYXfcfDPw9UmVBOJo+C9 V7XMFf1mxJsYFC8ygYk+VFZ4iUHf7AQjofEmUnuluTz03Tydpt+KDnESbVfRCTHhC0B3 R5IxdTyDqQtgOcSABPgQIM8xvb7LdVQhEOcKF/wEc0dyaEr6+9PsLBw5+imkTd8AkkyS u9TqIkr121Gk/QrNRYzOYxoWfJV+atBvKiqkclpTO7/eEjhytzS21i3hJgch29Vj9Ymn bMIg== X-Received: by 10.55.33.35 with SMTP id h35mr8836189qkh.71.1443790703645; Fri, 02 Oct 2015 05:58:23 -0700 (PDT) Received: from localhost ([2001:450:1e:232:3ea9:f4ff:fe4c:6bac]) by smtp.gmail.com with ESMTPSA id w3sm4561926qha.0.2015.10.02.05.58.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 05:58:22 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Fri, 2 Oct 2015 14:58:14 +0200 Message-Id: <1443790698-13327-2-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443790698-13327-1-git-send-email-marcandre.lureau@redhat.com> References: <1443790698-13327-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c09::231 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH v3 1/5] qga: add QGA_CONF environment variable 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: 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 --- 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)) {