From 6c1546e9190970aff32401277a8c5609bfa67f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sun, 24 Feb 2019 01:41:15 +0100 Subject: [PATCH] Workaround cURL bug --- nncmpp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nncmpp.c b/nncmpp.c index 7de838c..56ff1e9 100644 --- a/nncmpp.c +++ b/nncmpp.c @@ -286,6 +286,9 @@ poller_curl_on_socket_action (CURL *easy, curl_socket_t s, int what, } if (what == CURL_POLL_REMOVE) { + // Some annoying cURL bug. Never trust libraries. + fd->fd.closed = fcntl(fd->fd.fd, F_GETFL) < 0 && errno == EBADF; + poller_fd_reset (&fd->fd); LIST_UNLINK (self->fds, fd); free (fd);