git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] cast pid_t to long for printing

From
Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de>
Date
Jun 26, 2006, 08:26 UTC
Message-ID
<20060626082606.GC3646@informatik.uni-freiburg.de>
In-Reply-To
<20060626080912.GA3646@informatik.uni-freiburg.de>
This fixes warnings on Solaris 8.
Signed-off-by: Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de>
---

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
Previous: Uwe ZeisbergerNext: Junio C Hamano
Message 4 of 6 in “Solaris 8”
  1. Uwe ZeisbergerJun 26, 2006
  2. include signal.h for prototype of signal()Uwe Zeisberger, Jun 26, 2006
  3. Uwe ZeisbergerJun 26, 2006
  4. cast pid_t to long for printingUwe Zeisberger, Jun 26, 2006
  5. Junio C HamanoJun 26, 2006
  6. Uwe ZeisbergerJun 26, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.