@@ -4878,6 +4878,9 @@ int main(int argc, char **argv, char **envp)
CPUState *env;
int show_vnc_port = 0;
+ /* Prevent unfortunate early crash with debugging fprintf */
+ logfile=stdout;
+
init_clocks();
qemu_errors_to_file(stderr);
l
@@ -1494,7 +1494,7 @@ void cpu_single_step(CPUState *env, int enabled)
void cpu_set_log(int log_flags)
{
loglevel = log_flags;
- if (loglevel && !logfile) {
+ if (loglevel && (!logfile || logfile == stdout)) {
logfile = fopen(logfilename, log_append ? "a" : "w");
if (!logfile) {
perror(logfilename);
@@ -1521,7 +1521,7 @@ void cpu_set_log(int log_flags)
void cpu_set_log_filename(const char *filename)
{
logfilename = strdup(filename);
- if (logfile) {
+ if (logfile && logfile != stdout) {
fclose(logfile);
logfile = NULL;
}