mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Ticket #1748: lzma archives with .tlz extention are not recognized as archives
Attempting to open a .tlz lzma archive fails - error 'xxx.tlz doesn't look like a tar archive'. If the file is renamed to .tar.lzma, it is opened without problems. Fix issue: add recognize of '.tlz' extention. Refactoring: avoid calls of strlen() function Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
9c854e73d4
commit
575f996e0d
@ -861,6 +861,7 @@ enum compression_type
|
||||
get_compression_type (int fd, const char * name)
|
||||
{
|
||||
unsigned char magic[16];
|
||||
size_t str_len;
|
||||
|
||||
/* Read the magic signature */
|
||||
if (mc_read (fd, (char *) magic, 4) != 4)
|
||||
@ -937,8 +938,10 @@ get_compression_type (int fd, const char * name)
|
||||
}
|
||||
}
|
||||
|
||||
str_len = strlen(name);
|
||||
/* HACK: we must belive to extention of LZMA file :) ...*/
|
||||
if (strlen(name) > 5 && strcmp(&name[strlen(name)-5],".lzma") == 0)
|
||||
if ( (str_len > 5 && strcmp(&name[str_len-5],".lzma") == 0) ||
|
||||
(str_len > 4 && strcmp(&name[str_len-4],".tlz") == 0))
|
||||
return COMPRESSION_LZMA;
|
||||
|
||||
return COMPRESSION_NONE;
|
||||
|
Loading…
Reference in New Issue
Block a user