X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=lib%2Ftlsproxyhelper.c;h=1281dd86590bb6f09306cb15acbba3e516ebfde9;hb=8a180592112f4888f633edb51771f3fbf89f80b6;hp=68dcbb56e421cbc03490b299371777dae02ba69c;hpb=47779cdadbff9f9f7848828c97bf1dc63c3cb08f;p=tlsproxy%2Ftlsproxy.git diff --git a/lib/tlsproxyhelper.c b/lib/tlsproxyhelper.c index 68dcbb5..1281dd8 100644 --- a/lib/tlsproxyhelper.c +++ b/lib/tlsproxyhelper.c @@ -254,9 +254,9 @@ static int poll_for(int sockfd, int mode) { fds[0].fd = sockfd; fds[0].events = POLLERR | POLLHUP; /* Either poll for read or write possibility. */ - if (1 == mode) { + if (mode == 1) { fds[0].events |= POLLIN | POLLPRI; - } else if (0 == mode) { + } else if (mode == 0) { fds[0].events |= POLLOUT; } else { abort(); @@ -272,8 +272,12 @@ static int poll_for(int sockfd, int mode) { return -1; } - if (fds[0].revents & POLLERR || fds[0].revents & POLLHUP) { - fprintf(stderr, LOG_PREFIX "poll(): POLLERR | POLLHUP\n"); + if (fds[0].revents & POLLERR) { + fprintf(stderr, LOG_PREFIX "poll(): POLLERR\n"); + return -1; + } + if (fds[0].revents & POLLHUP) { + fprintf(stderr, LOG_PREFIX "poll(): POLLHUP\n"); return -1; }