diff options
author | Jussi Kivilinna <[email protected]> | 2022-02-12 18:37:48 +0000 |
---|---|---|
committer | Jussi Kivilinna <[email protected]> | 2022-03-08 18:00:31 +0000 |
commit | f2322ff942fabd55de0a1272b1fcca534e623bd1 (patch) | |
tree | 06d299bec082d33231ef80688e83de4a0649c20f /g10/sign.c | |
parent | gpgtar,w32: Support file names longer than MAX_PATH. (diff) | |
download | gnupg-f2322ff942fabd55de0a1272b1fcca534e623bd1.tar.gz gnupg-f2322ff942fabd55de0a1272b1fcca534e623bd1.zip |
Use iobuf buffer size for temporary buffer size
* common/iobuf.c (iobuf_copy): Use iobuf buffer size for temporary
buffers.
* g10/plaintext.c (handle_plaintext, do_hash): Likewise.
* g10/sign.c (sign_file): Likewise.
--
As iobuf will have zerocopy operation for read/write, it is better to
use same size buffers as iobuf for temporary copy buffers.
GnuPG-bug-id: T5828
Signed-off-by: Jussi Kivilinna <[email protected]>
Diffstat (limited to 'g10/sign.c')
-rw-r--r-- | g10/sign.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/g10/sign.c b/g10/sign.c index 981cc250a..bbcfabdb7 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -1294,6 +1294,8 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr, /* Setup the inner packet. */ if (detached) { + size_t iobuf_size = iobuf_set_buffer_size(0) * 1024; + if (multifile) { strlist_t sl; @@ -1328,7 +1330,7 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr, iobuf_push_filter (inp, text_filter, &tfx); } iobuf_push_filter (inp, md_filter, &mfx); - while (iobuf_read (inp, NULL, 1<<30) != -1) + while (iobuf_read (inp, NULL, iobuf_size) != -1) ; iobuf_close (inp); inp = NULL; @@ -1339,7 +1341,7 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr, else { /* Read, so that the filter can calculate the digest. */ - while (iobuf_read (inp, NULL, 1<<30) != -1) + while (iobuf_read (inp, NULL, iobuf_size) != -1) ; } } |