termpty: handle read() from tty pair when the other end has died, on some BSD

In such a case, read() returns 0 and sets errno to ECHILD…
This commit is contained in:
Boris Faure 2016-12-05 23:39:29 +01:00
parent 7508c8658b
commit 5770c51d86
1 changed files with 3 additions and 1 deletions

View File

@ -184,8 +184,10 @@ _cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler)
rbuf++;
len--;
}
errno = 0;
len = read(ty->fd, rbuf, len);
if (len < 0 && errno != EAGAIN)
if ((len < 0 && errno != EAGAIN) ||
(len == 0 && errno != 0))
{
/* Do not print error if the child has exited */
if (ty->pid != -1)