mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-22 07:57:31 +08:00
io: Return from read even if return == -1 and errno == 0
This happens on OpenIndiana/Solaris/Illumos/SunOS. Elsewhere we use read_blocked, which already returned in this case (and which we might want to use here as well!).
This commit is contained in:
parent
4132bb1a19
commit
c0dc1870f0
|
@ -95,12 +95,17 @@ void io_buffer_t::run_background_fillthread(autoclose_fd_t readfd) {
|
|||
scoped_lock locker(append_lock_);
|
||||
ssize_t ret;
|
||||
do {
|
||||
errno = 0;
|
||||
char buff[4096];
|
||||
ret = read(fd, buff, sizeof buff);
|
||||
if (ret > 0) {
|
||||
buffer_.append(&buff[0], &buff[ret]);
|
||||
} else if (ret == 0) {
|
||||
shutdown = true;
|
||||
} else if (ret == -1 && errno == 0) {
|
||||
// No specific error. We assume we just return,
|
||||
// since that's what we do in read_blocked.
|
||||
return;
|
||||
} else if (errno != EINTR && errno != EAGAIN) {
|
||||
wperror(L"read");
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue
Block a user