shithub: hx

Download patch

ref: 5788a6536a136a541c4987d97a8ef225275d2e9b
parent: face54aefe11b61cc95b2859d8c5c5396f868b25
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Jul 2 09:55:03 EDT 2021

fix -s causing endless loop on eof

--- a/hx.c
+++ b/hx.c
@@ -56,7 +56,12 @@
 	off = 0;
 	eof = 0;
 	sz = 0;
-	for (addr = 0; eof == 0 && (sz = read(fd, buf, Bufsz)) > 0;) {
+	for (addr = 0; eof == 0;) {
+		if ((sz = read(fd, buf, Bufsz)) < 1) {
+			section = 0;
+			break;
+		}
+
 		for (i = 0; i < sz; ) {
 			if (lineoff == 0) {
 				s[off++] = b2h[((addr>>55) & 0x1fe)];