mirror of https://github.com/mkerrisk/man-pages
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:
parent
344689bd06
commit
15277745c3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue