summaryrefslogtreecommitdiff
path: root/src/stream.c
diff options
context:
space:
mode:
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");