From 64d0b4cb703ce7a55b6d72d89bd8b355a5a93a5d Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Sat, 9 Feb 2008 19:01:49 +0000 Subject: Cope correctly with EOF --- termkey.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/termkey.c b/termkey.c index 74d6c49..7512d6b 100644 --- a/termkey.c +++ b/termkey.c @@ -1,5 +1,6 @@ #include "termkey.h" +#include #include #include @@ -370,7 +371,9 @@ void termkey_advisereadable(termkey_t *tk) unsigned char buffer[64]; // Smaller than the default size size_t len = read(tk->fd, buffer, sizeof buffer); - if(len == -1) + if(len == -1 && errno == EAGAIN) + return; + else if(len < 1) tk->is_closed = 1; else termkey_pushinput(tk, buffer, len); -- cgit v1.2.3-70-g09d2