patch 9.0.0803: readblob() cannot read from character device
Problem: readblob() cannot read from character device.
Solution: Use S_ISCHR() to not check the size. (Ken Takata, closes #11407)
diff --git a/src/blob.c b/src/blob.c
index 92efb67..a94316c 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -212,9 +212,13 @@
}
// 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)