From 15277745c36ce84afc5c151c38ee25d7d2982c58 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Tue, 4 Nov 2008 10:53:36 -0500 Subject: [PATCH] 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 Reported-by: Olaf van der Spek --- man7/epoll.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man7/epoll.7 b/man7/epoll.7 index 51f2d7076..990fe85c7 100644 --- a/man7/epoll.7 +++ b/man7/epoll.7 @@ -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;