From patchwork Tue Jun 29 08:46:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: make qemu.log name unique Date: Mon, 28 Jun 2010 22:46:20 -0000 From: Christophe LYON X-Patchwork-Id: 57255 Message-Id: <4C29B2DC.2030309@st.com> To: Hello, I propose this small patch so that the qemu log file has a unique name, to help running several QEmu processes at once (or with different users). Is it OK? Thanks Christophe. diff --git a/exec.c b/exec.c index 5969eb2..5ba8d7e 100644 --- a/exec.c +++ b/exec.c @@ -1516,7 +1516,10 @@ void cpu_set_log(int log_flags) void cpu_set_log_filename(const char *filename) { - logfilename = strdup(filename); + /* Assume 10 chars is enough to hold pid */ + int len = strlen(filename) + 10 + 1; + logfilename = malloc(len); + sprintf((char*)logfilename, "%s.%d", filename, getpid()); if (logfile) { fclose(logfile); logfile = NULL;