mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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>
This commit is contained in:
parent
1e36f6a5b5
commit
953ffe0f93
5 changed files with 10 additions and 4 deletions
|
@ -368,7 +368,7 @@ int qemu_create_pidfile(const char *filename)
|
|||
if (lockf(fd, F_TLOCK, 0) == -1) {
|
||||
return -1;
|
||||
}
|
||||
len = snprintf(buffer, sizeof(buffer), "%ld\n", (long)getpid());
|
||||
len = snprintf(buffer, sizeof(buffer), FMT_pid "\n", getpid());
|
||||
if (write(fd, buffer, len) != len) {
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue