From 40c75945ad594507035c6ab0b6879a7368ff6b38 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Tue, 4 Nov 2008 10:56:17 -0500 Subject: [PATCH] epoll.7: Add error handling for epoll_wait() call in example code Signed-off-by: Michael Kerrisk --- man7/epoll.7 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/man7/epoll.7 b/man7/epoll.7 index 990fe85c7..e6b163e53 100644 --- a/man7/epoll.7 +++ b/man7/epoll.7 @@ -18,7 +18,7 @@ .\" .\" Davide Libenzi .\" -.TH EPOLL 7 2008-11-01 "Linux" "Linux Programmer's Manual" +.TH EPOLL 7 2008-11-04 "Linux" "Linux Programmer's Manual" .SH NAME epoll \- I/O event notification facility .SH SYNOPSIS @@ -220,6 +220,10 @@ if (epoll_ctl(epollfd, EPOLL_CTL_ADD, listen_sock, &ev) == \-1) { for (;;) { nfds = epoll_wait(epollfd, events, MAX_EVENTS, \-1); + if (nfds == \-1) { + perror("epoll_pwait"); + exit(EXIT_FAILURE); + } for (n = 0; n < nfds; ++n) { if (events[n].data.fd == listen_sock) {