Hello,
In qemu_create_pidfile (osdep.c:229) the current pid and a newline is
written to the pidfile. However, the pidfile isn't truncated, so if it
is longer than the length of the pid and the newline character you get
trailing junk that can really mess up scripts.
I noticed this when going from a 5 digit pid to a 3 digit pid, so it
can happen in regular operation, especially if the OS randomizes pids.
Truncating the file fixes the bug.
dgym
*** osdep.c.orig Fri Nov 7 16:56:12 2008
--- osdep.c Fri Nov 7 16:58:49 2008
***************
*** 236,241 ****
--- 236,243 ----
len = snprintf(buffer, sizeof(buffer), "%ld\n", (long)getpid());
if (write(fd, buffer, len) != len)
return -1;
+
+ ftruncate(fd, len);
#else
HANDLE file;
DWORD flags;