From 44eb280f853f77a88a801fcbf725c93623e990af Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 20 Sep 2015 13:33:55 +0200 Subject: libsha2_sum_fd continues if interrupted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libsha2/files.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') 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 #include #include +#include @@ -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); } -- cgit v1.2.3-70-g09d2