X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tfc_skein.c;h=a3685783d28333bf58aa5de9b1c32007e8081e9f;hb=HEAD;hp=8102f70af122cff0cbeb7055150ea83267238494;hpb=1b12ee27233bd358a40406b5a7799230647c5ab1;p=tfcrypt.git diff --git a/tfc_skein.c b/tfc_skein.c index 8102f70..a368578 100644 --- a/tfc_skein.c +++ b/tfc_skein.c @@ -29,6 +29,11 @@ #include "tfcrypt.h" #include "tfcore.h" +static void exit_sigterm_skein(int signal) +{ + exit_sigterm(signal); +} + void skein(void *hash, size_t bits, const void *key, const void *data, size_t szdata) { struct skein sk; @@ -47,7 +52,6 @@ tfc_yesno skeinfd(void *hash, size_t bits, const void *key, int fd, tfc_fsize of tfc_byte *pblk; size_t ldone, lblock, lrem, lio; tfc_fsize total = 0; - tfc_yesno stop; if (ctr_mode == TFC_MODE_SKSUM) total_processed_src = total_processed_dst = delta_processed = 0; @@ -68,15 +72,15 @@ tfc_yesno skeinfd(void *hash, size_t bits, const void *key, int fd, tfc_fsize of else skein_init(&sk, bits); errno = 0; - stop = NO; + do_stop = NO; while (1) { - if (stop) break; + if (do_stop) break; pblk = skblk; lblock = lrem = blk_len_adj(readto, total, TFC_BLKSIZE); ldone = 0; if (error_action == TFC_ERRACT_SYNC) rdpos = tfc_fdgetpos(fd); _again: lio = xread(fd, pblk, lrem); - if (lio == 0) stop = YES; + if (lio == 0) do_stop = YES; if (lio != NOSIZE) ldone += lio; else { if (errno != EIO && catch_all_errors != YES) goto _fail; @@ -112,7 +116,10 @@ _again: lio = xread(fd, pblk, lrem); skein_final(hash, &sk); if (ctr_mode == TFC_MODE_SKSUM) { - if (verbose || status_timer) print_crypt_status(-1); + if (verbose || status_timer) { + print_crypt_status(TFC_SIGSTAT); + tfc_esay("\n"); + } total_processed_src = total_processed_dst = delta_processed = 0; } memset(skblk, 0, TFC_BLKSIZE); @@ -175,7 +182,7 @@ _dothat: sigaction(SIGQUIT, &sigact, NULL); sigact.sa_handler = change_status_timer; sigaction(SIGUSR2, &sigact, NULL); - sigact.sa_handler = exit_sigterm; + sigact.sa_handler = exit_sigterm_skein; sigaction(SIGINT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); sigact.sa_handler = handle_sigtstp; @@ -215,7 +222,7 @@ _dothat: s = strchr(shash, ' '); if (s && s[1] == ' ') *s = 0; - fd = open(fname, O_RDONLY | O_LARGEFILE); + fd = xxopen(YES, fname, O_RDONLY | O_LARGEFILE); if (fd == -1) { xerror(YES, NO, YES, "%s", fname); exitcode = 1; @@ -252,7 +259,7 @@ _dothat: fclose(f); if (failed) { tfc_esay("%s: WARNING: %u of %u computed checksums did NOT match", - progname, failed, totaltested); + tfc_format_pid(progname), failed, totaltested); exitcode = 1; } xexit(exitcode); @@ -267,7 +274,7 @@ _dothat: for (x = 0; fargv[x] && xx; x++) { if (!strcmp(fargv[x], "-")) fd = 0; - else fd = open(fargv[x], O_RDONLY | O_LARGEFILE); + else fd = xxopen(YES, fargv[x], O_RDONLY | O_LARGEFILE); if (fd == -1) { xerror(YES, NO, YES, "%s", fargv[x]); exitcode = 1;