From patchwork Fri Feb 19 13:27:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 8361091 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4AA6D9F372 for ; Fri, 19 Feb 2016 13:31:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 133DE2041D for ; Fri, 19 Feb 2016 13:31:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD38020382 for ; Fri, 19 Feb 2016 13:31:12 +0000 (UTC) Received: from localhost ([::1]:52314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWl9M-0001YC-53 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 19 Feb 2016 08:31:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWl6C-0004qS-23 for qemu-devel@nongnu.org; Fri, 19 Feb 2016 08:27:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWl69-0000Hn-T9 for qemu-devel@nongnu.org; Fri, 19 Feb 2016 08:27:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWl69-0000Hh-NX for qemu-devel@nongnu.org; Fri, 19 Feb 2016 08:27:53 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 65C138E750 for ; Fri, 19 Feb 2016 13:27:53 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-67.ams2.redhat.com [10.36.116.67]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1JDRpHf011248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 19 Feb 2016 08:27:53 -0500 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 95245303E59A; Fri, 19 Feb 2016 14:27:49 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 19 Feb 2016 14:27:46 +0100 Message-Id: <1455888469-3206-3-git-send-email-armbru@redhat.com> In-Reply-To: <1455888469-3206-1-git-send-email-armbru@redhat.com> References: <1455888469-3206-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Eduardo Habkost Subject: [Qemu-devel] [PULL 2/5] vl: Reset location after handling command-line arguments 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eduardo Habkost After looping through all command-line arguments, error location info becomes obsolete, and any function calling error_report() will print misleading information. This breaks error reporting for some option handling, like: $ qemu-system-x86_64 -icount rr=x -vnc :0 qemu-system-x86_64: -vnc :0: Invalid icount rr option: x $ qemu-system-x86_64 -m size= -vnc :0 qemu-system-x86_64: -vnc :0: missing 'size' option value Fix this by resetting location info as soon as we exit the command-line handling loop. With this, replay_configure() and set_memory_options() won't print any location info yet, but at least they won't print incorrect information. Signed-off-by: Eduardo Habkost Message-Id: <1455303747-19776-3-git-send-email-ehabkost@redhat.com> Reviewed-by: Laszlo Ersek ["Do not insert code here" comment added to prevent regressions] Signed-off-by: Markus Armbruster --- vl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 226bdeb..bf0ef90 100644 --- a/vl.c +++ b/vl.c @@ -4008,6 +4008,11 @@ int main(int argc, char **argv, char **envp) } } } + /* + * Clear error location left behind by the loop. + * Best done right after the loop. Do not insert code here! + */ + loc_set_none(); replay_configure(icount_opts); @@ -4015,8 +4020,6 @@ int main(int argc, char **argv, char **envp) set_memory_options(&ram_slots, &maxram_size, machine_class); - loc_set_none(); - os_daemonize(); if (qemu_init_main_loop(&main_loop_err)) {