summaryrefslogtreecommitdiff
path: root/src/fe-text/term-terminfo.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-11-03 13:12:15 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-11-03 13:12:15 +0000
commitab99ca723136dfbd689154bd179bf91e749ceaa9 (patch)
tree30a8576987c24149af15a278d90a6bbbe650432e /src/fe-text/term-terminfo.c
parent06435bea22a48b766f2e1538128551f49309c528 (diff)
downloadirssi-ab99ca723136dfbd689154bd179bf91e749ceaa9.zip
Quit if terminal gets lost.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1960 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/term-terminfo.c')
-rw-r--r--src/fe-text/term-terminfo.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index 85ac193b..88296131 100644
--- a/src/fe-text/term-terminfo.c
+++ b/src/fe-text/term-terminfo.c
@@ -328,6 +328,14 @@ void term_stop(void)
int term_gets(unsigned char *buffer, int size)
{
+ int ret;
+
/* fread() doesn't work */
- return read(fileno(current_term->in), buffer, size);
+ ret = read(fileno(current_term->in), buffer, size);
+ if (ret == 0)
+ ret = -1;/* EOF - terminal got lost */
+ else if (ret == -1 && (errno == EINTR || errno == EAGAIN))
+ ret = 0;
+
+ return ret;
}