summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Fliedel <rfliedel@freebox.fr>2018-11-05 11:46:56 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-11-20 19:58:41 +0100
commit47ccb2d204eb9c1d3e98b3febd616af42d82c184 (patch)
tree3d73340cb846f292d1c4c27a369763824eb973cb
parent7c96f6a14b224df8f335164250ae175de30a5a96 (diff)
downloadcurl-47ccb2d204eb9c1d3e98b3febd616af42d82c184.tar.gz
examples/ephiperfifo: report error when epoll_ctl fails
-rw-r--r--docs/examples/ephiperfifo.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/docs/examples/ephiperfifo.c b/docs/examples/ephiperfifo.c
index e27372598..efb27b1bd 100644
--- a/docs/examples/ephiperfifo.c
+++ b/docs/examples/ephiperfifo.c
@@ -257,7 +257,9 @@ static void remsock(SockInfo *f, GlobalInfo* g)
{
if(f) {
if(f->sockfd) {
- epoll_ctl(g->epfd, EPOLL_CTL_DEL, f->sockfd, NULL);
+ if(epoll_ctl(g->epfd, EPOLL_CTL_DEL, f->sockfd, NULL))
+ fprintf(stderr, "EPOLL_CTL_DEL failed for fd: %d : %s\n",
+ f->sockfd, strerror(errno));
}
free(f);
}
@@ -274,7 +276,9 @@ static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
(act & CURL_POLL_OUT ? EPOLLOUT : 0);
if(f->sockfd) {
- epoll_ctl(g->epfd, EPOLL_CTL_DEL, f->sockfd, NULL);
+ if(epoll_ctl(g->epfd, EPOLL_CTL_DEL, f->sockfd, NULL))
+ fprintf(stderr, "EPOLL_CTL_DEL failed for fd: %d : %s\n",
+ f->sockfd, strerror(errno));
}
f->sockfd = s;
@@ -283,7 +287,9 @@ static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
ev.events = kind;
ev.data.fd = s;
- epoll_ctl(g->epfd, EPOLL_CTL_ADD, s, &ev);
+ if(epoll_ctl(g->epfd, EPOLL_CTL_ADD, s, &ev))
+ fprintf(stderr, "EPOLL_CTL_ADD failed for fd: %d : %s\n",
+ s, strerror(errno));
}