From patchwork Sun Apr 20 12:05:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 340522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 61DC014009C for ; Sun, 20 Apr 2014 22:05:53 +1000 (EST) Received: from localhost ([::1]:45395 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbqVK-0004xv-Tn for incoming@patchwork.ozlabs.org; Sun, 20 Apr 2014 08:05:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbqUv-00040e-Vv for qemu-devel@nongnu.org; Sun, 20 Apr 2014 08:05:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WbqUj-0004lA-9s for qemu-devel@nongnu.org; Sun, 20 Apr 2014 08:05:25 -0400 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]:42805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbqUj-0004k4-2x; Sun, 20 Apr 2014 08:05:13 -0400 Received: by mail-pd0-f174.google.com with SMTP id y13so2802778pdi.19 for ; Sun, 20 Apr 2014 05:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=m//Tzdk28H67C1aOoe27vmmOA29aNi1ugT6sV34ahBM=; b=0yrBxwf1si0qWqLI1qgYhbZRVkmc94x4OXWoXZ36gwmkKN/JnAtkFZM/+bx0c3fV2N WftL7FoFz2aFk8zPpxHNGT+zdAAy89VUphanmwAjQcoKJB+63/Gm1XDoraWkq+A3Pgp4 /r7ZTU0xFq2CFjzHGJOYA4y2cBfQyCdxiAC8DiNBetBVPKP04WY4ifkxm7uN5rbqDXXA div854P1R1p6X5ESrcOi5PFzTw2zfSs5zMe2Kk5akVZ/BwMM5ps7MbvJB4zXEAAkmk+z Vjdwwa1RGnnrIW7eKwcpnVfNebDKeR9GZHZRNC1odNy39lpag0xAfA42C4IO20TuDSdE 6fYg== X-Received: by 10.68.201.165 with SMTP id kb5mr32165493pbc.80.1397995511108; Sun, 20 Apr 2014 05:05:11 -0700 (PDT) Received: from [192.168.1.101] ([223.72.65.54]) by mx.google.com with ESMTPSA id bc4sm71496318pbb.2.2014.04.20.05.05.08 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 20 Apr 2014 05:05:10 -0700 (PDT) Message-ID: <5353B7F9.4060803@gmail.com> Date: Sun, 20 Apr 2014 20:05:13 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Markus Armbruster , Peter Maydell , mjt@tls.msk.ru, aliguori@amazon.com X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::22e Cc: qemu-trivial@nongnu.org, QEMU Developers Subject: [Qemu-devel] [PATCH trivial] vl: Avoid to close stdout after finish 'writeconfig' option 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 After finish 'writeconfig' to stdout (with '-'), we want to copy/past the related information mannually, not for redirection ('readconfig' does not support '-'). So we can not close the stdout, or next options which may use stdout will not be displayed. Signed-off-by: Chen Gang Reviewed-by: Eric Blake --- vl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 9975e5a..215467f 100644 --- a/vl.c +++ b/vl.c @@ -3855,7 +3855,9 @@ int main(int argc, char **argv, char **envp) } } qemu_config_write(fp); - fclose(fp); + if (fp != stdout) { + fclose(fp); + } break; } case QEMU_OPTION_qtest: