From 92e2c77a5b5eeabc3252ea90953ab6bd1a8944d1 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 8 Feb 2023 14:08:34 +0100 Subject: libtar: remove need for skip_padding function In the istream implementation, automatically skip the padding when we reach end-of-file. Also skip file AND padding when we destroy the object. Replace the remaining instances with a simple istream_skip instead and remove the wrapper from libtar. Signed-off-by: David Oberhollenzer --- lib/tar/src/record_to_memory.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/tar/src/record_to_memory.c') diff --git a/lib/tar/src/record_to_memory.c b/lib/tar/src/record_to_memory.c index ba422de..43fd44c 100644 --- a/lib/tar/src/record_to_memory.c +++ b/lib/tar/src/record_to_memory.c @@ -27,8 +27,10 @@ char *record_to_memory(istream_t *fp, size_t size) goto fail; } - if (skip_padding(fp, size)) - goto fail; + if (size % 512) { + if (istream_skip(fp, 512 - (size % 512))) + goto fail; + } buffer[size] = '\0'; return buffer; -- cgit v1.2.3