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

[RFC][PATCH 08/10] Sparse: fix an "incorrect type in argument n" warning

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Jun 8, 2007, 22:24 UTC
Message-ID
<4669D714.5050805@ramsay1.demon.co.uk>

In particular, the warning referred to argument 3 in a call to accept() and alluded to the type of the actual and formal arguments being of a different signedness. The type of the formal parameter of accept is (socklen_t *), rather than (unsigned int *) as used here, so make the necessary changes to use socklen_t in the appropriate places.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 daemon.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/daemon.c b/daemon.c
index 64f1f34..9daa850 100644
--- a/daemon.c
+++ b/daemon.c
@@ -604,11 +604,11 @@ static unsigned int children_deleted;
 
 static struct child {
 	pid_t pid;
-	int addrlen;
+	socklen_t addrlen;
 	struct sockaddr_storage address;
 } live_child[MAX_CHILDREN];
 
-static void add_child(int idx, pid_t pid, struct sockaddr *addr, int addrlen)
+static void add_child(int idx, pid_t pid, struct sockaddr *addr, socklen_t addrlen)
 {
 	live_child[idx].pid = pid;
 	live_child[idx].addrlen = addrlen;
@@ -702,7 +702,7 @@ static void check_max_connections(void)
 	}
 }
 
-static void handle(int incoming, struct sockaddr *addr, int addrlen)
+static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
 {
 	pid_t pid = fork();
 
@@ -917,7 +917,7 @@ static int service_loop(int socknum, int *socklist)
 		for (i = 0; i < socknum; i++) {
 			if (pfd[i].revents & POLLIN) {
 				struct sockaddr_storage ss;
-				unsigned int sslen = sizeof(ss);
+				socklen_t sslen = sizeof(ss);
 				int incoming = accept(pfd[i].fd, (struct sockaddr *)&ss, &sslen);
 				if (incoming < 0) {
 					switch (errno) {
-- 
1.5.2
Message 1 of 1 in “Sparse: fix an "incorrect type in argument n" warning”
  1. Ramsay JonesJun 8, 2007

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.