1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Move the setting of the POLLIN flag to the bottom of the for loop

to ensure that the flag is only set when there is a valid fd.

Found by deraadt@

ok deraadt@ millert@
This commit is contained in:
brad 2008-05-24 02:39:23 +00:00
parent 34f52021d5
commit b3d3abd4e0

View File

@ -1,4 +1,4 @@
/* $OpenBSD: standalone.c,v 1.11 2007/05/11 01:47:48 ray Exp $ */
/* $OpenBSD: standalone.c,v 1.12 2008/05/24 02:39:23 brad Exp $ */
/*
* Standalone POP server: accepts connections, checks the anti-flood limits,
@ -146,7 +146,6 @@ int main(void)
if ((pfds[i].fd = socket(res->ai_family, res->ai_socktype,
res->ai_protocol)) < 0)
continue;
pfds[i].events = POLLIN;
if (setsockopt(pfds[i].fd, SOL_SOCKET, SO_REUSEADDR,
(void *)&true, sizeof(true))) {
@ -170,6 +169,7 @@ int main(void)
continue;
}
pfds[i].events = POLLIN;
i++;
}
freeaddrinfo(res0);