1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

xz: Check if the file already has custom suffix when compressing.

Now "xz -S .test foo.test" refuses to compress the
file because it already has the suffix .test. The man
page had it documented this way already.
This commit is contained in:
Lasse Collin 2011-02-04 11:29:47 +02:00
parent ecda90061d
commit 6decc8b418

View file

@ -183,6 +183,15 @@ compressed_name(const char *src_name, const size_t src_len)
} }
} }
if (custom_suffix != NULL) {
if (test_suffix(custom_suffix, src_name, src_len) != 0) {
message_warning(_("%s: File already has `%s' "
"suffix, skipping"), src_name,
custom_suffix);
return NULL;
}
}
// TODO: Hmm, maybe it would be better to validate this in args.c, // TODO: Hmm, maybe it would be better to validate this in args.c,
// since the suffix handling when decoding is weird now. // since the suffix handling when decoding is weird now.
if (opt_format == FORMAT_RAW && custom_suffix == NULL) { if (opt_format == FORMAT_RAW && custom_suffix == NULL) {