aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 6d10c00..9294f51 100644
--- a/src/util.c
+++ b/src/util.c
@@ -31,7 +31,10 @@ size_t read_from_stdin(void **buffer) {
for(*buffer = NULL; (*buffer = realloc((p = *buffer), len + step));
len += (size_t)r) {
- if((r = read(STDIN_FILENO, (uint8_t *)*buffer + len, step)) <= 0) {
+ if((r = read(STDIN_FILENO, (uint8_t *)*buffer + len, step)) == -1) {
+ perror(NULL);
+ break;
+ } else if (r == 0) {
break;
}
}