From: Sergey Ponomarev Date: Wed, 18 Sep 2019 06:23:10 +0000 (+0300) Subject: #1790 short tar's extensions tgz, txz, tlz4m .tzst should be decompressed with .tar... X-Git-Tag: v1.4.4~1^2~10^2~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dafe796e39492a180dacec35b4a4c963dcd88a37;p=thirdparty%2Fzstd.git #1790 short tar's extensions tgz, txz, tlz4m .tzst should be decompressed with .tar suffix --- diff --git a/programs/fileio.c b/programs/fileio.c index 96170b14a..5aaad0e96 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -2212,6 +2212,15 @@ FIO_determineDstName(const char* srcFileName) assert(dstFileNameBuffer != NULL); size_t dstFileNameEndPos = sfnSize - suffixSize; memcpy(dstFileNameBuffer, srcFileName, dstFileNameEndPos); + /* The short tar extensions tzst, tgz, txz and tlz4 files should have "tar" extension on decompression + * To check that the file is one of them we can check that it starts with "t" + */ + if (suffixPtr[1] == 't') { + dstFileNameBuffer[dstFileNameEndPos++] = '.'; + dstFileNameBuffer[dstFileNameEndPos++] = 't'; + dstFileNameBuffer[dstFileNameEndPos++] = 'a'; + dstFileNameBuffer[dstFileNameEndPos++] = 'r'; + } dstFileNameBuffer[dstFileNameEndPos] = '\0'; return dstFileNameBuffer;