From f85b5fbaef5eb2d39b538dafcfd490cecd7f5c0d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 20 Sep 2015 13:32:33 +0200 Subject: libkeccak_generalised_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/libkeccak/files.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libkeccak/files.c b/src/libkeccak/files.c index e415126..95e9889 100644 --- a/src/libkeccak/files.c +++ b/src/libkeccak/files.c @@ -23,6 +23,7 @@ #include #include #include +#include /** @@ -58,8 +59,14 @@ int libkeccak_generalised_sum_fd(int fd, libkeccak_state_t* restrict state, 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; if (libkeccak_fast_update(state, chunk, (size_t)got) < 0) return -1; } -- cgit v1.2.3-70-g09d2