sock/child: remove global variable addrlen.

This changes listen_sock() to not return the
addrlen of the used address from getaddrinfo call
to the caller, stored in global addrlen in child.c.

This was only used to be able to allocate enough space for the
arguments to the later accept call depending on whether
IPv4 or IPv6 is used.

This removes the need to pass this info by always allocating
sizeof(struct sockaddr_storage) instead, which is enough
to carry both sockaddr_in and sockaddr_in6.

Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Michael Adam committed 2013-11-09 13:34:33 +01:00
1 parent 4bbd6e8626
commit 7eea1638bc
3 files changed
+8 -13

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@
#define MAXLINE (1024 * 4)
extern int opensock (const char *host, int port, const char *bind_to);
extern int listen_sock (uint16_t port, socklen_t * addrlen);
extern int listen_sock (uint16_t port);
extern int socket_nonblocking (int sock);
extern int socket_blocking (int sock);