[PATCH] cast pid_t to long for printing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes warnings on Solaris 8.

Signed-off-by: Uwe Zeisberger <zeisberg@xxxxxxxxxxxxxxxxxxxxxxxxxx>

---

While fixing daemon.c, I saw that there is a call to syslog using %d for
pid_t, too.  I fixed that in the same way without further testing and
manual reading. I assume that's OK.

 daemon.c      |    9 ++++++---
 upload-pack.c |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

b339b05462efea5fee9f2b9bf70de03897a5e4ab
diff --git a/daemon.c b/daemon.c
index 1ba4d66..8641b13 100644
--- a/daemon.c
+++ b/daemon.c
@@ -368,7 +368,7 @@ static void remove_child(pid_t pid, unsi
 		struct child m;
 		deleted = (deleted + 1) % MAX_CHILDREN;
 		if (deleted == spawned)
-			die("could not find dead child %d\n", pid);
+			die("could not find dead child %ld\n", (long)pid);
 		m = live_child[deleted];
 		live_child[deleted] = n;
 		if (m.pid == pid)
@@ -476,9 +476,12 @@ static void child_handler(int signo)
 				if (!WIFEXITED(status) || WEXITSTATUS(status) > 0)
 					dead = " (with error)";
 				if (log_syslog)
-					syslog(LOG_INFO, "[%d] Disconnected%s", pid, dead);
+					syslog(LOG_INFO, "[%ld] Disconnected%s",
+					       (long)pid, dead);
 				else
-					fprintf(stderr, "[%d] Disconnected%s\n", pid, dead);
+					fprintf(stderr,
+						"[%ld] Disconnected%s\n",
+						(long)pid, dead);
 			}
 			continue;
 		}
diff --git a/upload-pack.c b/upload-pack.c
index 7b86f69..fdfef39 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -274,7 +274,7 @@ static void create_pack_file(void)
 					goto fail;
 				}
 				error("git-upload-pack: we weren't "
-				      "waiting for %d", pid);
+				      "waiting for %ld", (long)pid);
 				continue;
 			}
 			if (!WIFEXITED(status) || WEXITSTATUS(status) > 0) {
-- 
1.1.6.g7d80e

-- 
Uwe Zeisberger

exit vi, lesson V:
o : q ! CTRL-V <CR> <Esc> " d d d @ d
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]