summaryrefslogtreecommitdiffstats
path: root/src/md5util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/md5util.c')
-rw-r--r--src/md5util.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/md5util.c b/src/md5util.c
index e4c3269..6b9a1e2 100644
--- a/src/md5util.c
+++ b/src/md5util.c
@@ -28,6 +28,7 @@
#include "md5util.h"
#include "md5.h"
+#include "syrep.h"
void fhex(const unsigned char *bin,int len, char *txt) {
const static char hex[] = "0123456789abcdef";
@@ -46,7 +47,7 @@ int fdmd5(int fd, size_t l, char *md) {
void *d;
off_t o = 0;
size_t m;
- int r = 0;
+ int r = -1;
md5_state_t s;
struct stat pre, post;
void *p = NULL;
@@ -65,6 +66,11 @@ int fdmd5(int fd, size_t l, char *md) {
while (l && ((d = mmap(NULL, m, PROT_READ, MAP_SHARED, fd, o)) != MAP_FAILED)) {
md5_append(&s, d, m);
munmap(d, m);
+
+ if (interrupted) {
+ fprintf(stderr, "Canceled.\n");
+ goto finish;
+ }
o += m;
l -= m;
@@ -112,6 +118,8 @@ int fdmd5(int fd, size_t l, char *md) {
md5_finish(&s, md);
+ r = 0;
+
finish:
if (p)