aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Gang <gang.chen.5i5j@gmail.com>2014-04-22 09:12:34 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2014-04-28 08:55:31 +0400
commit7fb8b5d9c4ef6a49457155e1b7a002c227cd8bbd (patch)
tree71ef421f5dbc691748d259a3cc80d65e2cc48c2f
parent24c12b79235ca8187f6652900c1d25a10cbdac71 (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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index 773649f023..236f95efd7 100644
--- a/vl.c
+++ b/vl.c
@@ -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: