X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=tfcrypt.c;h=3534bb836c76b8ee3b9dbdca3215f728a9b2c731;hb=10d07f6813a5909bb9ae957bc7424b3ad3099b93;hp=5ed5bbf1979cad49d5ee15bc876495b82ebc822a;hpb=ee5e048cace46d40dfb9fe450eb00f977c78ab12;p=tfcrypt.git diff --git a/tfcrypt.c b/tfcrypt.c index 5ed5bbf..3534bb8 100644 --- a/tfcrypt.c +++ b/tfcrypt.c @@ -376,6 +376,17 @@ _baddfname: if (counter_opt == TFC_CTR_HEAD) maxlen += TF_BLOCK_SIZE; } + else if (!strncmp(s, "ftrunc", 6) && *(s+6) == '=') { + s += 7; + ftrunc_dfd = tfc_humanfsize(s, &stoi); + if (!str_empty(stoi)) { + ftrunc_dfd = tfc_fnamesize(s, YES); + ftrunc_dfd = tfc_modifysize(ftrunc_dfd, strchr(s, ':')); + if (ftrunc_dfd == NOFSIZE) xerror(NO, YES, YES, + "%s: invalid ftrunc value", s); + } + else ftrunc_dfd = tfc_modifysize(ftrunc_dfd, strchr(s, ':')); + } else if (!strncmp(s, "xkey", 4) && *(s+4) == '=') { s += 5; maxkeylen = tfc_humanfsize(s, &stoi); @@ -1277,6 +1288,7 @@ _nomac: if (do_preserve_time) fcopy_matime(dfd, &s_stat); xclose(sfd); + if (ftrunc_dfd != NOFSIZE) if (ftruncate(dfd, (off_t)ftrunc_dfd) == -1) xerror(YES, NO, YES, "ftruncate(%d)", dfd); xclose(dfd); xexit(exitcode);