summaryrefslogtreecommitdiffstats
path: root/src/blob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/blob.c')
-rw-r--r--src/blob.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/blob.c b/src/blob.c
index 92efb67ab5..a94316c13f 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -212,9 +212,13 @@ read_blob(FILE *fd, typval_T *rettv, off_T offset, off_T size_arg)
}
// Trying to read bytes that aren't there results in an empty blob, not an
// error.
- if (size < 0 || size > st.st_size)
+ if (size <= 0 || (
+#ifdef S_ISCHR
+ !S_ISCHR(st.st_mode) &&
+#endif
+ size > st.st_size))
return OK;
- if (vim_fseek(fd, offset, whence) != 0)
+ if (offset != 0 && vim_fseek(fd, offset, whence) != 0)
return OK;
if (ga_grow(&blob->bv_ga, (int)size) == FAIL)