From 2a9a13e951cb7bcc4d81b3e6f1e23c5185ec77af Mon Sep 17 00:00:00 2001 From: Andrey Rys Date: Sun, 28 Nov 2021 14:47:18 +0100 Subject: [PATCH] another attempt to fix newline bugs --- VERSION | 2 +- tfc_random.c | 18 ++++++++++++++++-- tfc_skein.c | 8 +++++++- tfcrypt.c | 2 ++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 59343b0..fb1e7bc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -53 +54 diff --git a/tfc_random.c b/tfc_random.c index ccafe5c..9ef321d 100644 --- a/tfc_random.c +++ b/tfc_random.c @@ -28,6 +28,20 @@ #include "tfcrypt.h" +static void print_crypt_status_genrnd(int signal) +{ + if (signal == SIGTERM || signal == SIGINT) { + if (xexit_no_nl == YES) xexit_no_nl = NO; + } + print_crypt_status(signal); +} + +static void exit_sigterm_genrnd(int signal) +{ + if (xexit_no_nl == YES) xexit_no_nl = NO; + exit_sigterm(signal); +} + static void get_urandom(const char *src, void *buf, size_t size) { tfc_byte *ubuf = buf; @@ -102,13 +116,13 @@ void gen_write_bytes(const char *foutname, tfc_fsize offset, tfc_fsize nrbytes) sigact.sa_handler = change_status_timer; sigaction(SIGUSR2, &sigact, NULL); if (quiet == NO) { - sigact.sa_handler = print_crypt_status; + sigact.sa_handler = print_crypt_status_genrnd; sigaction(SIGINT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); sigaction(SIGTSTP, &sigact, NULL); } else { - sigact.sa_handler = exit_sigterm; + sigact.sa_handler = exit_sigterm_genrnd; sigaction(SIGINT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); sigact.sa_handler = handle_sigtstp; diff --git a/tfc_skein.c b/tfc_skein.c index e2c31f9..0917819 100644 --- a/tfc_skein.c +++ b/tfc_skein.c @@ -29,6 +29,12 @@ #include "tfcrypt.h" #include "tfcore.h" +static void exit_sigterm_skein(int signal) +{ + if (xexit_no_nl == YES) xexit_no_nl = NO; + exit_sigterm(signal); +} + void skein(void *hash, size_t bits, const void *key, const void *data, size_t szdata) { struct skein sk; @@ -179,7 +185,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; diff --git a/tfcrypt.c b/tfcrypt.c index e5ac31a..054e768 100644 --- a/tfcrypt.c +++ b/tfcrypt.c @@ -1251,6 +1251,8 @@ _nowrite: total_processed_dst += ldone; } } + if (verbose && status_timer && do_statline_dynamic == YES && statline_was_shown == YES) tfc_esay("\n"); + errno = 0; if (do_mac >= TFC_MAC_VRFY) { if (!do_mac_file) { -- 2.31.1