From: Philip Homburg Date: Wed, 14 Jun 2006 13:18:53 +0000 (+0000) Subject: Retry read after EINTR. X-Git-Tag: v3.1.3~345 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/zones/static/Bv9ARM.ch07.html?a=commitdiff_plain;h=a617a46e35e94313cbaeeae91d346613c3761c87;p=minix.git Retry read after EINTR. --- diff --git a/lib/editline/editline.c b/lib/editline/editline.c index 50a776718..b17be01d1 100755 --- a/lib/editline/editline.c +++ b/lib/editline/editline.c @@ -4,6 +4,7 @@ */ #include "editline.h" #include +#include #include /* @@ -168,6 +169,7 @@ STATIC unsigned int TTYget() { CHAR c; + int r; TTYflush(); if (Pushed) { @@ -176,7 +178,11 @@ TTYget() } if (*Input) return *Input++; - return read(0, &c, (SIZE_T)1) == 1 ? c : EOF; + do + { + r= read(0, &c, (SIZE_T)1); + } while (r == -1 && errno == EINTR); + return r == 1 ? c : EOF; } #define TTYback() (backspace ? TTYputs((CHAR *)backspace) : TTYput('\b'))