summaryrefslogtreecommitdiff
path: root/tar
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-03 12:28:37 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-03 12:28:37 +0200
commitb51a3ab10fad0d00c6fe2aa4d4c1afc6cfcf371f (patch)
tree323767920e7518c0509757f1a83c57d56daf0338 /tar
parentc25949ab28b916c89d719d3a011df5ae36b9087f (diff)
Add no-skip option to tar2sqfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar')
-rw-r--r--tar/tar2sqfs.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index dec717b..e239acd 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -24,13 +24,14 @@ static struct option long_opts[] = {
{ "dev-block-size", required_argument, NULL, 'B' },
{ "defaults", required_argument, NULL, 'd' },
{ "comp-extra", required_argument, NULL, 'X' },
+ { "no-skip", no_argument, NULL, 's' },
{ "force", no_argument, NULL, 'f' },
{ "quiet", no_argument, NULL, 'q' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
};
-static const char *short_opts = "c:b:B:d:X:fqhV";
+static const char *short_opts = "c:b:B:d:X:sfqhV";
static const char *usagestr =
"Usage: tar2sqfs [OPTIONS...] <sqfsfile>\n"
@@ -58,6 +59,8 @@ static const char *usagestr =
" mode=<value> 0755 if not set.\n"
" mtime=<value> 0 if not set.\n"
"\n"
+" --no-skip, -s Abort if a tar record cannot be read instead\n"
+" of skipping it.\n"
" --force, -f Overwrite the output file if it exists.\n"
" --quiet, -q Do not print out progress reports.\n"
" --help, -h Print help text and exit.\n"
@@ -78,6 +81,7 @@ static int outmode = O_WRONLY | O_CREAT | O_EXCL;
static E_SQFS_COMPRESSOR comp_id;
static char *comp_extra = NULL;
static char *fs_defaults = NULL;
+static bool dont_skip = false;
static void process_args(int argc, char **argv)
{
@@ -124,6 +128,9 @@ static void process_args(int argc, char **argv)
case 'd':
fs_defaults = optarg;
break;
+ case 's':
+ dont_skip = true;
+ break;
case 'f':
outmode = O_WRONLY | O_CREAT | O_TRUNC;
break;
@@ -224,8 +231,7 @@ static int process_tar_ball(fstree_t *fs, data_writer_t *data)
skip = false;
if (hdr.unknown_record) {
- fprintf(stderr, "skipping '%s' (unknown entry type)\n",
- hdr.name);
+ fprintf(stderr, "%s: unknown entry type\n", hdr.name);
skip = true;
}
@@ -246,12 +252,14 @@ static int process_tar_ball(fstree_t *fs, data_writer_t *data)
skip = true;
if (skip) {
- fprintf(stderr, "skipping '%s' (broken sparse "
+ fprintf(stderr, "%s: broken sparse "
"file layout)\n", hdr.name);
}
}
if (skip) {
+ if (dont_skip)
+ goto fail;
if (skip_entry(STDIN_FILENO, hdr.sb.st_size))
goto fail;
continue;