Sparse: fix an "incorrect type in argument n" warning
RFC PATCH 8/10 Sparse: fix an "incorrect type in argument n" warning
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 <[email protected]>
--- daemon.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
daemon.c +4 -4
@@ -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) {
Signature · 1 line
1.5.2