All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH trivial v2] vl: avoid closing stdout with 'writeconfig'
@ 2014-04-22  1:12 Chen Gang
  2014-04-24 15:14 ` Michael Tokarev
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Gang @ 2014-04-22  1:12 UTC (permalink / raw)
  To: Eric Blake, Markus Armbruster, Peter Maydell, Michael Tokarev,
	Anthony Liguori
  Cc: QEMU Trivial, QEMU Developers

'writeconfig' supports output to stdout (with '-'); when that happens,
we must not close stdout, or further command line options that also use
stdout will be impacted. (Although 'writeconfig' was copied from
'readconfig', the latter does not have the problem because it does not
support reading from '-')

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 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:
-- 
1.7.11.7




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-25  1:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22  1:12 [Qemu-trivial] [PATCH trivial v2] vl: avoid closing stdout with 'writeconfig' Chen Gang
2014-04-24 15:14 ` Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.