diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-09-13 13:37:42 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-09-16 09:34:35 +0200 |
commit | f757737060d4daebb24a32e90d912661428708a8 (patch) | |
tree | a6e96145d4fc540e435c13a69c924329db2edb6d /lib/tar/skip.c | |
parent | c1a2cb729bd5bb5fdadf00cb3968bbc541f79750 (diff) |
Remodel libtar/tar2sqfs to read data from an istream_t
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/tar/skip.c')
-rw-r--r-- | lib/tar/skip.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/lib/tar/skip.c b/lib/tar/skip.c deleted file mode 100644 index 36cd470..0000000 --- a/lib/tar/skip.c +++ /dev/null @@ -1,44 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * skip.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "config.h" - -#include "tar.h" - -#include <stdio.h> - -static int skip_bytes(FILE *fp, sqfs_u64 size) -{ - unsigned char buffer[1024]; - size_t diff; - - while (size != 0) { - diff = sizeof(buffer); - if (diff > size) - diff = size; - - if (read_retry("reading tar record padding", fp, buffer, diff)) - return -1; - - size -= diff; - } - - return 0; -} - -int skip_padding(FILE *fp, sqfs_u64 size) -{ - size_t tail = size % 512; - - return tail ? skip_bytes(fp, 512 - tail) : 0; -} - -int skip_entry(FILE *fp, sqfs_u64 size) -{ - size_t tail = size % 512; - - return skip_bytes(fp, tail ? (size + 512 - tail) : size); -} |