diff options
author | Chen Gang <gang.chen.5i5j@gmail.com> | 2014-04-22 09:12:34 +0800 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2014-04-28 08:55:31 +0400 |
commit | 7fb8b5d9c4ef6a49457155e1b7a002c227cd8bbd (patch) | |
tree | 71ef421f5dbc691748d259a3cc80d65e2cc48c2f | |
parent | 24c12b79235ca8187f6652900c1d25a10cbdac71 (diff) |
vl: avoid closing stdout with 'writeconfig'
'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>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r-- | vl.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -3890,7 +3890,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: |