shithub: mc

Download patch

ref: ff614fa9710df61b6607ec9c38d6d909f5aa2d35
parent: cf57ad51e7ae7744b8a723f6d5fe6d67ca7c509c
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Dec 11 15:50:20 EST 2016

Use rdbuf to read floats.

	We were using fread, which returned the count (1), and erroring
	out here. Using rdbuf is both more consistent, and not broken.

--- a/util/pack.c
+++ b/util/pack.c
@@ -183,8 +183,7 @@
 		double fval;
 	} u;
 
-	if (fread(buf, 8, 1, fd) < 8)
-		die("Unexpected EOF");
+	rdbuf(fd, buf, 8);
 	u.ival = host64(buf);
 	return u.fval;
 }