diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-05-24 02:39:24 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-05-24 02:39:24 +0000 |
commit | f6891dd4cd5d7d7bd89702ca060797c7797c67c6 (patch) | |
tree | 6484abb456e30da3f45bba3fe7dd8c50f34b48d2 /usr.sbin | |
parent | 17597ad2afb50133e284a84457ec06bc53022b22 (diff) |
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@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/popa3d/standalone.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/popa3d/standalone.c b/usr.sbin/popa3d/standalone.c index b3fc26a8fc6..f5f390351ca 100644 --- a/usr.sbin/popa3d/standalone.c +++ b/usr.sbin/popa3d/standalone.c @@ -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); |