summaryrefslogtreecommitdiff
path: root/src/stream.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2023-12-14 19:38:55 -0500
committerFreya Murphy <freya@freyacat.org>2023-12-14 19:38:55 -0500
commit3d10d02620a0e587d765f6042ab05f530b201c39 (patch)
treeb28191352881a99286adfd798080b4325e259b55 /src/stream.c
parenttesting (diff)
downloadnbtvis-3d10d02620a0e587d765f6042ab05f530b201c39.tar.gz
nbtvis-3d10d02620a0e587d765f6042ab05f530b201c39.tar.bz2
nbtvis-3d10d02620a0e587d765f6042ab05f530b201c39.zip
initial stable
Diffstat (limited to 'src/stream.c')
-rw-r--r--src/stream.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stream.c b/src/stream.c
index 1993df6..622fafa 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1,6 +1,7 @@
#include "stream.h"
#include "lib.h"
+#include <errno.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
@@ -34,7 +35,7 @@ bool stream_read(stream_t *stream, void *res, size_t amount) {
read = fread(res, 1, amount, stream->__file);
if (read == 0) {
- if (feof(stream->__file))
+ if (feof(stream->__file) || errno == 0)
return false;
else
perror_and_die("cannot read open stream");