summaryrefslogtreecommitdiffstats
path: root/src/printf-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/printf-utils.c')
-rw-r--r--src/printf-utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/printf-utils.c b/src/printf-utils.c
index 9e2f99d..2056f85 100644
--- a/src/printf-utils.c
+++ b/src/printf-utils.c
@@ -77,7 +77,8 @@ void printf_and_wait(const char * format, ...) {
FD_SET(0, &rfds);
while ( select(1, &rfds, NULL, NULL, &tv) == 1 )
- read(0, &c, 1);
+ if ( read(0, &c, 1) < 0 )
+ break;
va_start(ap, format);
vprintf(format, ap);
@@ -88,8 +89,7 @@ void printf_and_wait(const char * format, ...) {
FD_SET(0, &rfds);
while ( select(1, &rfds, NULL, NULL, NULL) == 1 ) {
- read(0, &c, 1);
- if ( c == '\n' )
+ if ( read(0, &c, 1) < 0 || c == '\n' )
break;
}