+ if (pfds[i].revents & POLLHUP) {
+ /* Linux gives this if connecting to local
+ * non-listening port */
+ close(pfds[i].fd);
+ pfds[i].fd = -1;
+ if (pfds[!i].fd == -1) {
+ errno = ECONNREFUSED;
+ return -1;
+ }
+ continue;
+ }
+ if (!(pfds[i].revents & POLLOUT))
+ continue;
+