summaryrefslogtreecommitdiff
path: root/dynstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'dynstr.c')
-rw-r--r--dynstr.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/dynstr.c b/dynstr.c
index 339cf47..ac276ae 100644
--- a/dynstr.c
+++ b/dynstr.c
@@ -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)