aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-09-20 13:32:33 +0200
committerMattias Andrée <maandree@operamail.com>2015-09-20 13:32:33 +0200
commitf85b5fbaef5eb2d39b538dafcfd490cecd7f5c0d (patch)
tree8da9c1b108b467993ce911ee2ca2744280a08707 /src
parentinfo: representation conversion (diff)
downloadlibkeccak-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>
Diffstat (limited to '')
-rw-r--r--src/libkeccak/files.c11
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;
}