Cast the getpid() return value and adapt the format string. Avoids the following warning:
CC simpletrace.o /Data/QEMU/qemu/simpletrace.c: In function 'st_set_trace_file': /Data/QEMU/qemu/simpletrace.c:77: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'pid_t' v2: * Don't use %lu for getpid() on Haiku since on x86_64 it returns an int. Always cast to long (largest allowed pid_t type) and use %ld instead. Suggested by Ingo Weinhold. Cc: Stefan Hajnoczi <stefa...@linux.vnet.ibm.com> Cc: Blue Swirl <blauwir...@gmail.com> Cc: Ingo Weinhold <ingo_weinh...@gmx.de> Signed-off-by: Andreas Färber <andreas.faer...@web.de> --- configure | 2 +- simpletrace.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index d303061..457d98c 100755 --- a/configure +++ b/configure @@ -2609,7 +2609,7 @@ if test "$trace_backend" = "simple"; then fi # Set the appropriate trace file. if test "$trace_backend" = "simple"; then - trace_file="\"$trace_file-%u\"" + trace_file="\"$trace_file-%ld\"" fi echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak diff --git a/simpletrace.c b/simpletrace.c index f849e42..9ee5c3b 100644 --- a/simpletrace.c +++ b/simpletrace.c @@ -74,7 +74,7 @@ bool st_set_trace_file(const char *file) free(trace_file_name); if (!file) { - if (asprintf(&trace_file_name, CONFIG_TRACE_FILE, getpid()) < 0) { + if (asprintf(&trace_file_name, CONFIG_TRACE_FILE, (long)getpid()) < 0) { trace_file_name = NULL; return false; } -- 1.7.3