@matheusbsbs / matheus-bagliano / commits / 7fa090844f
Fork 0

Use int instead of socklen_t

This should work around the compilation problem Johannes Schindelin and others had on Mac OS/X. Quoting Linus: Any operating system where socklen_t is anything else than "int" is terminally broken. The people who introduced that typedef were confused, and I actually had to argue with them that it was fundamentally wrong: there is no other valid type than "int" that makes sense for it. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Sep 11, 2005 at 13:58 UTC 7fa090844f7d1624c7d1ffc621aae6aec84a1110
1 file changed +4 -4
daemon.c
+4 -4
@@ -80,11 +80,11 @@ static unsigned int children_deleted = 0;
80
81 static struct child {
82 pid_t pid;
83 - socklen_t addrlen;
83 + int addrlen;
84 struct sockaddr_storage address;
85 } live_child[MAX_CHILDREN];
86
87 -static void add_child(int idx, pid_t pid, struct sockaddr *addr, socklen_t addrlen)
87 +static void add_child(int idx, pid_t pid, struct sockaddr *addr, int addrlen)
88 {
89 live_child[idx].pid = pid;
90 live_child[idx].addrlen = addrlen;
@@ -178,7 +178,7 @@ static void check_max_connections(void)
178 }
179 }
180
181 -static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
181 +static void handle(int incoming, struct sockaddr *addr, int addrlen)
182 {
183 pid_t pid = fork();
184
@@ -308,7 +308,7 @@ static int serve(int port)
308
309 if (FD_ISSET(sockfd, &fds)) {
310 struct sockaddr_storage ss;
311 - socklen_t sslen = sizeof(ss);
311 + int sslen = sizeof(ss);
312 int incoming = accept(sockfd, (struct sockaddr *)&ss, &sslen);
313 if (incoming < 0) {
314 switch (errno) {