From: Chen Gang Date: Tue, 22 Apr 2014 01:12:34 +0000 (+0800) Subject: vl: avoid closing stdout with 'writeconfig' X-Git-Tag: v2.1.0-rc0~160^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fb8b5d9c4ef6a49457155e1b7a002c227cd8bbd;p=thirdparty%2Fqemu.git 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 Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- diff --git a/vl.c b/vl.c index 773649f0238..236f95efd79 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: