cast pid_t's to uintmax_t to improve portability

Some systems (like e.g. OpenSolaris) define pid_t as long,
therefore all our sprintf that use %i/%d cause a compiler warning
beacuse of the implicit long->int cast. To make sure that
we fit the limits, we display pids as PRIuMAX and cast them explicitly
to uintmax_t.

Signed-off-by: David Soria Parra <dsp@php.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
David Soria Parra
2008-08-31 14:09:39 +02:00
committed by Junio C Hamano
parent 7f314565fe
commit 85e7283069
5 changed files with 9 additions and 9 deletions

View File

@ -320,7 +320,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
die("unable to write new_index file");
fd = hold_lock_file_for_update(&false_lock,
git_path("next-index-%d", getpid()), 1);
git_path("next-index-%"PRIuMAX, (uintmax_t) getpid()), 1);
create_base_index();
add_remove_files(&partial);