summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-12-11 20:50:20 -0800
committerOri Bernstein <ori@eigenstate.org>2016-12-11 20:50:20 -0800
commitff614fa9710df61b6607ec9c38d6d909f5aa2d35 (patch)
tree5fc2cbc46c453660a196b48ea24046fba4f68863
parentcf57ad51e7ae7744b8a723f6d5fe6d67ca7c509c (diff)
downloadmc-ff614fa9710df61b6607ec9c38d6d909f5aa2d35.tar.gz
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.
-rw-r--r--util/pack.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/util/pack.c b/util/pack.c
index e2efccd..aea907b 100644
--- a/util/pack.c
+++ b/util/pack.c
@@ -183,8 +183,7 @@ double rdflt(FILE *fd)
double fval;
} u;
- if (fread(buf, 8, 1, fd) < 8)
- die("Unexpected EOF");
+ rdbuf(fd, buf, 8);
u.ival = host64(buf);
return u.fval;
}