diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-09-20 13:32:33 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-09-20 13:32:33 +0200 |
commit | f85b5fbaef5eb2d39b538dafcfd490cecd7f5c0d (patch) | |
tree | 8da9c1b108b467993ce911ee2ca2744280a08707 | |
parent | info: representation conversion (diff) | |
download | libkeccak-f85b5fbaef5eb2d39b538dafcfd490cecd7f5c0d.tar.gz libkeccak-f85b5fbaef5eb2d39b538dafcfd490cecd7f5c0d.tar.bz2 libkeccak-f85b5fbaef5eb2d39b538dafcfd490cecd7f5c0d.tar.xz |
libkeccak_generalised_sum_fd continues if interrupted
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | src/libkeccak/files.c | 11 |
1 files changed, 9 insertions, 2 deletions
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 <unistd.h> #include <sys/stat.h> #include <alloca.h> +#include <errno.h> /** @@ -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; } |