X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=lib%2Ftlsproxyhelper.c;h=5f8d2c868c5abb4cbd5c1137c13f4833b03770c0;hb=7eba49d24d56288d83746f3f0ce383d7c0c36552;hp=68dcbb56e421cbc03490b299371777dae02ba69c;hpb=47779cdadbff9f9f7848828c97bf1dc63c3cb08f;p=tlsproxy%2Ftlsproxy.git diff --git a/lib/tlsproxyhelper.c b/lib/tlsproxyhelper.c index 68dcbb5..5f8d2c8 100644 --- a/lib/tlsproxyhelper.c +++ b/lib/tlsproxyhelper.c @@ -12,7 +12,7 @@ */ /* - * Copyright (C) 2011-2013 Simon Ruderich + * Copyright (C) 2011-2014 Simon Ruderich * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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; }