epoll.7: Fix error handling after accept() in example code

Simply continuing after an error is in most cases wrong,
and can lead to infinite loops (e.g., for EMFILE).
So handle an error by terminating.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504202

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Reported-by: Olaf van der Spek <olafvdspek@gmail.com>
This commit is contained in:
Michael Kerrisk 2008-11-04 10:53:36 -05:00
parent 344689bd06
commit 15277745c3
1 changed files with 1 additions and 1 deletions

View File

@ -227,7 +227,7 @@ for (;;) {
(struct sockaddr *) &local, &addrlen);
if (conn_sock == \-1) {
perror("accept");
continue;
exit(EXIT_FAILURE);
}
setnonblocking(conn_sock);
ev.events = EPOLLIN | EPOLLET;