$OpenBSD: patch-netio_c,v 1.1 2008/06/09 22:54:38 martynas Exp $
--- netio.c.orig	Sun Feb 17 15:43:58 2008
+++ netio.c	Sat Jun  7 15:29:06 2008
@@ -44,6 +44,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <assert.h>
+#include <fcntl.h>
 
 #include <ncurses.h>
 
@@ -87,7 +88,12 @@ int NetPoll (struct feed * cur_ptr, int * my_socket, i
 	
 	if (rw == NET_READ) {
 		FD_SET(*my_socket, &rfdsr);
-		if (select (*my_socket+1, &rfdsr, NULL, NULL, &tv) == 0) {
+		do {
+			retval = select (*my_socket+1, &rfdsr, NULL, NULL,
+			&tv);
+		}
+		while (retval == -1 && errno == EINTR);
+		if (retval == 0) {
 			/* Timed out */
 			cur_ptr->netio_error = NET_ERR_TIMEOUT;
 			return -1;
@@ -101,7 +107,12 @@ int NetPoll (struct feed * cur_ptr, int * my_socket, i
 		}
 	} else if (rw == NET_WRITE) {
 		FD_SET(*my_socket, &rfdsw);
-		if (select (*my_socket+1, NULL, &rfdsw, NULL, &tv) == 0) {
+		do {
+			retval = select (*my_socket+1, NULL, &rfdsw, NULL,
+			&tv);
+		}
+		while (retval == -1 && errno == EINTR);
+		if (retval == 0) {
 			/* Timed out */
 			cur_ptr->netio_error = NET_ERR_TIMEOUT;
 			return -1;
@@ -158,6 +169,8 @@ int NetConnect (int * my_socket, char * host, struct f
 		return -1;
 	}
 	
+	fcntl(*my_socket, F_SETFL, O_NONBLOCK);
+
 	/* If proxyport is 0 we didn't execute the if http_proxy statement in main
 	   so there is no proxy. On any other value of proxyport do proxyrequests instead. */
 	if (proxyport == 0) {
