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>
Этот коммит содержится в:
родитель
9c854e73d4
Коммит
575f996e0d
@ -861,6 +861,7 @@ enum compression_type
|
|||||||
get_compression_type (int fd, const char * name)
|
get_compression_type (int fd, const char * name)
|
||||||
{
|
{
|
||||||
unsigned char magic[16];
|
unsigned char magic[16];
|
||||||
|
size_t str_len;
|
||||||
|
|
||||||
/* Read the magic signature */
|
/* Read the magic signature */
|
||||||
if (mc_read (fd, (char *) magic, 4) != 4)
|
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 :) ...*/
|
/* 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_LZMA;
|
||||||
|
|
||||||
return COMPRESSION_NONE;
|
return COMPRESSION_NONE;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user