aboutsummaryrefslogtreecommitdiffstats
path: root/tools/gpgtar-extract.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gpgtar-extract.c')
-rw-r--r--tools/gpgtar-extract.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c
index 1ea359755..6e506d94d 100644
--- a/tools/gpgtar-extract.c
+++ b/tools/gpgtar-extract.c
@@ -66,7 +66,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)
{