X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tfc_error.c;h=d74fd567c7cbe241d04395f7582376f22695cc3a;hb=f98c367a4cf1ed9f0c6d7620e3f1988596945495;hp=17efe74a443659633b103c507bc1a4b4240a8f2c;hpb=0d620a6eb276b6610913a5d944e380f00d589a43;p=tfcrypt.git diff --git a/tfc_error.c b/tfc_error.c index 17efe74..d74fd56 100644 --- a/tfc_error.c +++ b/tfc_error.c @@ -62,6 +62,17 @@ _ex: void xexit(int status) { + if (status > 1) goto _do_clean_and_exit; + + xclose(sfd); + if (do_ftrunc > TFC_NO_FTRUNC) { + if (do_ftrunc == TFC_FTRUNC_TAIL) ftrunc_dfd = total_processed_dst; + if (ftruncate(dfd, (off_t)ftrunc_dfd) == -1) xerror(YES, NO, YES, "ftruncate(%d)", dfd); + } + if (do_preserve_time) fcopy_matime(dfd, &s_stat); + xclose(dfd); + +_do_clean_and_exit: memset(srcblk, 0, sizeof(srcblk)); memset(dstblk, 0, sizeof(dstblk)); @@ -269,7 +280,11 @@ void usage(void) tfc_say(" -: read a detached MAC signature from stdin,"); tfc_say(" drop: do not verify attached MAC, if any, and drop it from output."); tfc_say(" -m: just verify MAC provided with -M. Do not write output file."); - tfc_say(" This option must be specified after -M."); + tfc_say(" -u: almost same as -m, but turns on MAC pre-test mode, when verified"); + tfc_say(" signature enables writing output file. It is useful when decrypting small texts."); + tfc_say(" The source must be a seekable file, otherwise this mode will be disabled."); + tfc_say(" In this mode, decryption is done twice and verification done once."); + tfc_say(" Both -m and -u options must be specified after -M."); tfc_say(" -E how: how to behave on I/O errors (both src or dst):"); tfc_say(" exit: print error if not quiet, then exit,"); tfc_say(" cont: print error if not quiet, then continue,"); @@ -286,6 +301,7 @@ void usage(void) tfc_say(" -E xall: turn on error actions above for all errors, not just EIO errors."); tfc_say(" -E xseek: ignore positioning and other seek related errors."); tfc_say(" Multiple -E specifiers may be given in separate options."); + tfc_say(" -o logfile: redirect all messages to logfile instead of stderr."); tfc_say(" -O opts: set options (comma separated list):"); tfc_say(" sync: request a synchronous I/O for a output,"); tfc_say(" fsync: on each write() call a corresponding fsync(fd),"); @@ -303,6 +319,7 @@ void usage(void) tfc_say(" prompt=str: set main password prompts to this string."); tfc_say(" macprompt=str: set MAC password prompts to this string."); tfc_say(" shorthex: with -H, do not print printable characters, dump only hex string."); + tfc_say(" logfile: (same as -o) redirect all messages to logfile instead of stderr."); tfc_say(" iobs=val: set IO block size value. Must not exceed %u bytes.", TFC_U(TFC_BLKSIZE)); tfc_say(" xtsblocks=val: use these nr of TF blocks per XTS block. Default is %u.", TFC_U(TFC_XTSBLOCKS)); tfc_say(" iseek=val: seek source file/device by these val bytes.");