diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c index 736c7fc4b..b0d31e02e 100644 --- a/tools/gpgtar-extract.c +++ b/tools/gpgtar-extract.c @@ -73,7 +73,11 @@ extract_regular (estream_t stream, const char *dirname, if (err) goto leave; n++; - nbytes = (n < hdr->nrecords)? RECORDSIZE : (hdr->size % RECORDSIZE); + if (n < hdr->nrecords || (hdr->size && !(hdr->size % RECORDSIZE))) + nbytes = RECORDSIZE; + else + nbytes = (hdr->size % RECORDSIZE); + nwritten = es_fwrite (record, 1, nbytes, outfp); if (nwritten != nbytes) {