From: Wayne Davison Date: Tue, 27 Jan 2004 07:57:12 +0000 (+0000) Subject: Better pid handling. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/05b7bab8e1d97d300ad43accd9857d611c63a673 Better pid handling. --- diff --git a/clientserver.c b/clientserver.c index 963d9fe7..a2bbfe87 100644 --- a/clientserver.c +++ b/clientserver.c @@ -614,7 +614,7 @@ int daemon_main(void) if (((pid_file = lp_pid_file()) != NULL) && (*pid_file != '\0')) { char pidbuf[16]; int fd; - int pid = (int) getpid(); + pid_t pid = getpid(); cleanup_set_pid(pid); if ((fd = do_open(lp_pid_file(), O_WRONLY|O_CREAT|O_TRUNC, 0666 & ~orig_umask)) == -1) { @@ -622,7 +622,7 @@ int daemon_main(void) rsyserr(FLOG, errno, "failed to create pid file %s", pid_file); exit_cleanup(RERR_FILEIO); } - snprintf(pidbuf, sizeof(pidbuf), "%d\n", pid); + snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid); write(fd, pidbuf, strlen(pidbuf)); close(fd); }