diff options
Diffstat (limited to 'dynstr.c')
-rw-r--r-- | dynstr.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -402,8 +402,10 @@ static size_t fread_callback(FILE *f, int fd, unsigned char *buf, size_t size) static size_t read_callback(FILE *f, int fd, unsigned char *buf, size_t size) { ssize_t n; - - n = read(fd, buf, size); + + do { + n = read(fd, buf, size); + } while (n == -1 && errno == EAGAIN); if (n == -1) return DYNSTR_ERROR; return n; @@ -511,8 +513,10 @@ static int readline_callback(FILE *f, int fd) { unsigned char c; int n; - - n = read(fd, &c, 1); + + do { + n = read(fd, &c, 1); + } while (n == -1 && errno == EAGAIN); if (n == 0) return -2; else if (n == -1) |