shithub: hx

Download patch

ref: e2c59cc4b3c33545ece46e80b0ea97f6b9a18bb9
parent: 9937039372fdaea29cd4d562ebeac18527d52dd2
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Dec 28 09:47:13 EST 2019

don't need select at all, just write as much as we got

--- a/hx.c
+++ b/hx.c
@@ -8,8 +8,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/select.h>
-#include <sys/time.h>
 #include <unistd.h>
 
 enum
@@ -37,8 +35,6 @@
 	ssize_t sz, i;
 	char s[65536], c;
 	unsigned char line[16];
-	fd_set set;
-	struct timeval timeout;
 	int wroff, off, eof, lineoff, r;
 
 #ifdef __linux__
@@ -113,14 +109,8 @@
 #ifdef __linux__
 		readahead(fd, addr, Bufsz);
 #endif
-		FD_ZERO(&set);
-		FD_SET(fd, &set);
-		timeout.tv_sec = 0;
-		timeout.tv_usec = 1000;
-		if (select(fd+1, &set, NULL, NULL, &timeout) == 0) {
-			sz = 0;
-			goto writes;
-		}
+		sz = 0;
+		goto writes;
 	}
 
 	if (sz >= 0) {