Git development
 help / color / mirror / Atom feed
* [RFC][PATCH 08/10] Sparse: fix an "incorrect type in argument n" warning
@ 2007-06-08 22:24 Ramsay Jones
  0 siblings, 0 replies; only message in thread
From: Ramsay Jones @ 2007-06-08 22:24 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list


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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-08 23:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-08 22:24 [RFC][PATCH 08/10] Sparse: fix an "incorrect type in argument n" warning Ramsay Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox