1
0
forked from aniani/vim

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)
This commit is contained in:
K.Takata
2022-10-20 13:28:51 +01:00
committed by Bram Moolenaar
parent 4c36678ffd
commit 43625762a9
5 changed files with 20 additions and 4 deletions

View File

@@ -6859,7 +6859,12 @@ readblob({fname} [, {offset} [, {size}]]) *readblob()*
readblob('file.bin', 0, 100)
< If {size} is -1 or omitted, the whole data starting from
{offset} will be read.
When the file can't be opened an error message is given and
This can be also used to read the data from a character device
on Unix when {size} is explicitly set. Only if the device
supports seeking {offset} can be used. Otherwise it should be
zero. E.g. to read 10 bytes from a serial console: >
readblob('/dev/ttyS0', 0, 10)
< When the file can't be opened an error message is given and
the result is an empty |Blob|.
When trying to read bytes beyond the end of the file the
result is an empty blob.