summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7f31456)
raw | patch | inline | side by side (parent: 7f31456)
author | David Soria Parra <dsp@php.net> | |
Sun, 31 Aug 2008 12:09:39 +0000 (14:09 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 31 Aug 2008 23:56:22 +0000 (16:56 -0700) |
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>
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>
builtin-commit.c | patch | blob | history | |
builtin-fetch-pack.c | patch | blob | history | |
daemon.c | patch | blob | history | |
fast-import.c | patch | blob | history | |
receive-pack.c | patch | blob | history |
diff --git a/builtin-commit.c b/builtin-commit.c
index c870037b07ca00aeeeb369fdae98c9b828be0af2..b75d5e931d1427f431fa493553c3eac203caccd6 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
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);
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 273239af3be61736ee4ff484d628950c4de7311a..17a5a422c27e898fb68e3d55a9a5d7e714a40ff6 100644 (file)
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
*av++ = "--fix-thin";
if (args.lock_pack || unpack_limit) {
int s = sprintf(keep_arg,
- "--keep=fetch-pack %d on ", getpid());
+ "--keep=fetch-pack %"PRIuMAX " on ", (uintmax_t) getpid());
if (gethostname(keep_arg + s, sizeof(keep_arg) - s))
strcpy(keep_arg + s, "localhost");
*av++ = keep_arg;
diff --git a/daemon.c b/daemon.c
index 23278e28dc16cc30bd9516f2f2675cd93d5ac182..c315932ced825f96f669003616a9fb304309c75d 100644 (file)
--- a/daemon.c
+++ b/daemon.c
* Since stderr is set to linebuffered mode, the
* logging of different processes will not overlap
*/
- fprintf(stderr, "[%d] ", (int)getpid());
+ fprintf(stderr, "[%"PRIuMAX"] ", (uintmax_t)getpid());
vfprintf(stderr, err, params);
fputc('\n', stderr);
}
remove_child(pid);
if (!WIFEXITED(status) || (WEXITSTATUS(status) > 0))
dead = " (with error)";
- loginfo("[%d] Disconnected%s", (int)pid, dead);
+ loginfo("[%"PRIuMAX"] Disconnected%s", (uintmax_t)pid, dead);
}
}
FILE *f = fopen(path, "w");
if (!f)
die("cannot open pid file %s: %s", path, strerror(errno));
- if (fprintf(f, "%d\n", getpid()) < 0 || fclose(f) != 0)
+ if (fprintf(f, "%"PRIuMAX"\n", (uintmax_t) getpid()) < 0 || fclose(f) != 0)
die("failed to write pid file %s: %s", path, strerror(errno));
}
diff --git a/fast-import.c b/fast-import.c
index 7089e6f9e6c5fa9142f468e54afe7d33a6d2eec7..acb8e2e360910574ef3b85546a82425bf1696d11 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
static void write_crash_report(const char *err)
{
- char *loc = git_path("fast_import_crash_%d", getpid());
+ char *loc = git_path("fast_import_crash_%"PRIuMAX, (uintmax_t) getpid());
FILE *rpt = fopen(loc, "w");
struct branch *b;
unsigned long lu;
fprintf(stderr, "fast-import: dumping crash report to %s\n", loc);
fprintf(rpt, "fast-import crash report:\n");
- fprintf(rpt, " fast-import process: %d\n", getpid());
- fprintf(rpt, " parent process : %d\n", getppid());
+ fprintf(rpt, " fast-import process: %"PRIuMAX"\n", (uintmax_t) getpid());
+ fprintf(rpt, " parent process : %"PRIuMAX"\n", (uintmax_t) getppid());
fprintf(rpt, " at %s\n", show_date(time(NULL), 0, DATE_LOCAL));
fputc('\n', rpt);
diff --git a/receive-pack.c b/receive-pack.c
index d44c19e6b577023dcbaa188a0e67130ff4e5bd9a..b81678a9705c3f4bb7a6ff47e2af87db70e0ef66 100644 (file)
--- a/receive-pack.c
+++ b/receive-pack.c
char keep_arg[256];
struct child_process ip;
- s = sprintf(keep_arg, "--keep=receive-pack %i on ", getpid());
+ s = sprintf(keep_arg, "--keep=receive-pack %"PRIuMAX" on ", (uintmax_t) getpid());
if (gethostname(keep_arg + s, sizeof(keep_arg) - s))
strcpy(keep_arg + s, "localhost");