diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-02-09 19:01:49 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-02-09 19:01:49 +0000 |
commit | 64d0b4cb703ce7a55b6d72d89bd8b355a5a93a5d (patch) | |
tree | 5d17e789bb81a015063ab6d5a136aab2daaaa732 | |
parent | 1f6ae5e40d2ded8d0feb91b786393f4e26dbca1f (diff) | |
download | termo-64d0b4cb703ce7a55b6d72d89bd8b355a5a93a5d.tar.gz termo-64d0b4cb703ce7a55b6d72d89bd8b355a5a93a5d.tar.xz termo-64d0b4cb703ce7a55b6d72d89bd8b355a5a93a5d.zip |
Cope correctly with EOF
-rw-r--r-- | termkey.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1,5 +1,6 @@ #include "termkey.h" +#include <errno.h> #include <unistd.h> #include <string.h> @@ -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); |