From 064e3c024f388b36af5d39702cbf64e24613cb4f Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Thu, 29 Apr 2010 20:41:32 +0200 Subject: Properly use long to map pid_t. --- fetchmail.c | 24 ++++++++++++------------ lock.c | 5 +++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/fetchmail.c b/fetchmail.c index 93ce7128..e3eebfdd 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -446,8 +446,8 @@ int main(int argc, char **argv) } else if (kill(pid, SIGTERM) < 0) { - fprintf(stderr,GT_("fetchmail: error killing %s fetchmail at %d; bailing out.\n"), - bkgd ? GT_("background") : GT_("foreground"), pid); + fprintf(stderr,GT_("fetchmail: error killing %s fetchmail at %ld; bailing out.\n"), + bkgd ? GT_("background") : GT_("foreground"), (long)pid); exit(PS_EXCLUDE); } else @@ -455,8 +455,8 @@ int main(int argc, char **argv) int maxwait; if (outlevel > O_SILENT) - fprintf(stderr,GT_("fetchmail: %s fetchmail at %d killed.\n"), - bkgd ? GT_("background") : GT_("foreground"), pid); + fprintf(stderr,GT_("fetchmail: %s fetchmail at %ld killed.\n"), + bkgd ? GT_("background") : GT_("foreground"), (long)pid); /* We used to nuke the other process's lock here, with * fm_lock_release(), which is broken. The other process * needs to clear its lock by itself. */ @@ -484,15 +484,15 @@ int main(int argc, char **argv) else if (!implicitmode) { fprintf(stderr, - GT_("fetchmail: can't poll specified hosts with another fetchmail running at %d.\n"), - pid); + GT_("fetchmail: can't poll specified hosts with another fetchmail running at %ld.\n"), + (long)pid); return(PS_EXCLUDE); } else if (!bkgd) { fprintf(stderr, - GT_("fetchmail: another foreground fetchmail is running at %d.\n"), - pid); + GT_("fetchmail: another foreground fetchmail is running at %ld.\n"), + (long)pid); return(PS_EXCLUDE); } else if (getpid() == pid) @@ -507,8 +507,8 @@ int main(int argc, char **argv) else if (kill(pid, SIGUSR1) == 0) { fprintf(stderr, - GT_("fetchmail: background fetchmail at %d awakened.\n"), - pid); + GT_("fetchmail: background fetchmail at %ld awakened.\n"), + (long)pid); return(0); } else @@ -519,8 +519,8 @@ int main(int argc, char **argv) * SIGUSR1/SIGHUP transmission. */ fprintf(stderr, - GT_("fetchmail: elder sibling at %d died mysteriously.\n"), - pid); + GT_("fetchmail: elder sibling at %ld died mysteriously.\n"), + (long)pid); return(PS_UNDEFINED); } } diff --git a/lock.c b/lock.c index 111559e7..213969f1 100644 --- a/lock.c +++ b/lock.c @@ -73,13 +73,14 @@ void fm_lock_dispose(void) int fm_lock_state(void) { - int pid, st; + long pid; + int st; FILE *lockfp; int bkgd = FALSE; if ((lockfp = fopen(lockfile, "r")) != NULL) { - int args = fscanf(lockfp, "%d %d", &pid, &st); + int args = fscanf(lockfp, "%ld %d", &pid, &st); bkgd = (args == 2); if (ferror(lockfp)) { -- cgit v1.2.3