[RFC][PATCH 08/10] Sparse: fix an "incorrect type in argument n" warning
From: Ramsay Jones <hidden>
Date: 2016-06-15 22:43:14
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- 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