From 5fe214c0d45c28aaace79b917783570530a2f926 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 14 Jul 2012 11:17:07 -0700 Subject: [PATCH] u8-istream: Retry read upon EINTR. This seems unlikely to be a problem, since we're normally dealing with regular files, for which reads are uninterruptible, but it can't hurt. --- src/libpspp/u8-istream.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libpspp/u8-istream.c b/src/libpspp/u8-istream.c index 77c14133ea..b172b164f5 100644 --- a/src/libpspp/u8-istream.c +++ b/src/libpspp/u8-istream.c @@ -194,8 +194,12 @@ fill_buffer (struct u8_istream *is) is->head = is->buffer; /* Read more input. */ - n = read (is->fd, is->buffer + is->length, - U8_ISTREAM_BUFFER_SIZE - is->length); + do + { + n = read (is->fd, is->buffer + is->length, + U8_ISTREAM_BUFFER_SIZE - is->length); + } + while (n < 0 && errno == EINTR); if (n > 0) is->length += n; return n; -- 2.30.2