diff options
author | Andreas Färber <andreas.faerber@web.de> | 2011-06-02 19:58:06 +0200 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-06-15 19:58:48 +0000 |
commit | f425043ffa3d82144f953db74edbc877c921edcd (patch) | |
tree | 4ccd1b5bffe7fca88063582a32653c1974a96d9e /os-win32.c | |
parent | 5eab0f84f048170d4cf3627385935784ba32701e (diff) | |
download | qemu-f425043ffa3d82144f953db74edbc877c921edcd.tar.gz qemu-f425043ffa3d82144f953db74edbc877c921edcd.tar.bz2 qemu-f425043ffa3d82144f953db74edbc877c921edcd.zip |
Introduce format string for pid_t
BeOS and Haiku on i386 use long for 32-bit types, including pid_t.
Using %d with pid_t therefore results in a warning.
Unfortunately POSIX:2008 does not define a PRId* string for pid_t.
In some places pid_t was previously casted to long and %ld hardcoded.
The predecessor of this patch added another upcast for the simpletrace
filename but was not applied to date.
Since new uses of pid_t with %d keep creeping in, let's instead define
an OS-dependent format string and use that consistently.
Cc: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Ingo Weinhold <ingo_weinhold@gmx.de>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'os-win32.c')
-rw-r--r-- | os-win32.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/os-win32.c b/os-win32.c index d6d54c60b9..b6652af7f3 100644 --- a/os-win32.c +++ b/os-win32.c @@ -258,7 +258,7 @@ int qemu_create_pidfile(const char *filename) if (file == INVALID_HANDLE_VALUE) { return -1; } - len = snprintf(buffer, sizeof(buffer), "%ld\n", (long)getpid()); + len = snprintf(buffer, sizeof(buffer), FMT_pid "\n", getpid()); ret = WriteFileEx(file, (LPCVOID)buffer, (DWORD)len, &overlap, NULL); if (ret == 0) { |