aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-05-13 19:28:23 +0800
committerJia Tan <jiat0218@gmail.com>2023-07-17 23:34:55 +0800
commitf281cd0d692ac0c70fc7669b80dddb863ea947e1 (patch)
treeb6aa3e876099136c8bc61e86bd9ca485a37e1ecb /src
parentxz: Create command line options for filters[1-9]. (diff)
downloadxz-f281cd0d692ac0c70fc7669b80dddb863ea947e1.tar.xz
xz: Add a message if --block-list is used outside of xz compresssion.
--block-list is only supported with compression in xz format. This avoids silently ignoring when --block-list is unused.
Diffstat (limited to 'src')
-rw-r--r--src/xz/args.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/xz/args.c b/src/xz/args.c
index b2eee193..6ae3c96f 100644
--- a/src/xz/args.c
+++ b/src/xz/args.c
@@ -788,6 +788,17 @@ args_parse(args_info *args, int argc, char **argv)
if (opt_mode == MODE_COMPRESS && opt_format == FORMAT_AUTO)
opt_format = FORMAT_XZ;
+ // Set opt_block_list to NULL if we are not compressing to the .xz
+ // format. This option cannot be used outside of this case, and
+ // simplifies the implementation later.
+ if ((opt_mode != MODE_COMPRESS || opt_format != FORMAT_XZ)
+ && opt_block_list != NULL) {
+ message(V_WARNING, _("--block-list is ignored unless "
+ "compressing to the .xz format"));
+ free(opt_block_list);
+ opt_block_list = NULL;
+ }
+
// Compression settings need to be validated (options themselves and
// their memory usage) when compressing to any file format. It has to
// be done also when uncompressing raw data, since for raw decoding