child.c: properly initialize fdset for each select() call (#216)

it was reported that because the fdset was only initialized once,
tinyproxy would fail to properly listen on more than one interface.

closes #214
closes #127
This commit is contained in:
rofl0r 2018-12-15 17:09:04 +00:00 committed by GitHub
parent dc41b35333
commit b131f45cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,6 +206,9 @@ static void child_main (struct child_s *ptr)
* We have to wait for connections on multiple fds, * We have to wait for connections on multiple fds,
* so use select. * so use select.
*/ */
while (!config.quit) {
int listenfd = -1;
FD_ZERO(&rfds); FD_ZERO(&rfds);
@ -224,9 +227,6 @@ static void child_main (struct child_s *ptr)
maxfd = max(maxfd, *fd); maxfd = max(maxfd, *fd);
} }
while (!config.quit) {
int listenfd = -1;
ptr->status = T_WAITING; ptr->status = T_WAITING;
clilen = sizeof(struct sockaddr_storage); clilen = sizeof(struct sockaddr_storage);