From: Ben Pfaff Date: Sat, 14 Jul 2012 18:17:07 +0000 (-0700) Subject: u8-istream: Retry read upon EINTR. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fe214c0d45c28aaace79b917783570530a2f926;p=pspp 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. --- 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;