]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
#1790 short tar's extensions tgz, txz, tlz4m .tzst should be decompressed with .tar...
authorSergey Ponomarev <stokito@gmail.com>
Wed, 18 Sep 2019 06:23:10 +0000 (09:23 +0300)
committerSergey Ponomarev <stokito@gmail.com>
Wed, 18 Sep 2019 06:23:10 +0000 (09:23 +0300)
programs/fileio.c

index 96170b14a99c3558b66de33e6fb1da8220998142..5aaad0e96cc8f853dae9ef67e4a3973d461062ca 100644 (file)
@@ -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;