X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=lib%2Ftlsproxyhelper.c;h=1281dd86590bb6f09306cb15acbba3e516ebfde9;hb=8a180592112f4888f633edb51771f3fbf89f80b6;hp=529dc55d922a39c5287fce0b94ebb7fd21aee2ea;hpb=579d66b3f6fcaed5b235f8d9111bf22100f5bd14;p=tlsproxy%2Ftlsproxy.git diff --git a/lib/tlsproxyhelper.c b/lib/tlsproxyhelper.c index 529dc55..1281dd8 100644 --- a/lib/tlsproxyhelper.c +++ b/lib/tlsproxyhelper.c @@ -185,7 +185,7 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { return -1; } if (optval != 0) { - fprintf(stderr, LOG_PREFIX "connect() failed (SO_ERROR)"); + fprintf(stderr, LOG_PREFIX "connect() failed (SO_ERROR)\n"); errno = EINVAL; return -1; } @@ -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; }