mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 08:48:16 +00:00
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 vim/vim#11407)
43625762a9
S_ISCHR is always defined in Nvim.
Co-authored-by: K.Takata <kentkt@csc.jp>
This commit is contained in:
@@ -5893,10 +5893,11 @@ int read_blob(FILE *const 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 > (off_T)os_fileinfo_size(&file_info)) {
|
||||
if (size < 0 || (!S_ISCHR(file_info.stat.st_mode)
|
||||
&& size > (off_T)os_fileinfo_size(&file_info))) {
|
||||
return OK;
|
||||
}
|
||||
if (vim_fseek(fd, offset, whence) != 0) {
|
||||
if (offset != 0 && vim_fseek(fd, offset, whence) != 0) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user