aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libsha2/files.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libsha2/files.c b/src/libsha2/files.c
index 2f4bb72..903c592 100644
--- a/src/libsha2/files.c
+++ b/src/libsha2/files.c
@@ -22,6 +22,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include <alloca.h>
+#include <errno.h>
@@ -54,8 +55,14 @@ int libsha2_sum_fd(int fd, libsha2_algorithm_t algorithm, char* restrict hashsum
for (;;)
{
got = read(fd, chunk, blksize);
- if (got < 0) return -1;
- if (got == 0) break;
+ if (got < 0)
+ {
+ if (errno == EINTR)
+ continue;
+ return -1;
+ }
+ if (got == 0)
+ break;
libsha2_update(&state, chunk, (size_t)got);
}