]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Added check to perform comparison only if extension is present
authorShashank Tavildar <shtavi@fb.com>
Tue, 29 Oct 2019 19:56:04 +0000 (12:56 -0700)
committerShashank Tavildar <shtavi@fb.com>
Tue, 29 Oct 2019 19:56:04 +0000 (12:56 -0700)
programs/util.c

index f6933bc83ffc2290bdd0951603f040fccba9671d..c93382c63df801c64def555f79263055aabfffd5 100644 (file)
@@ -334,13 +334,16 @@ NO => return 0
 int UTIL_isCompressedFile(const char *inputName, const char *extensionList[])
 {
   const char* ext = UTIL_getFileExtension(inputName);
-   while(*extensionList!=NULL)
-   {
-     const char* isCompressedExtension = strstr(ext,*extensionList);
-     if(isCompressedExtension)
-        return 1;
-      ++extensionList;
-   }
+  if(strcmp(ext,""))
+  {
+     while(*extensionList!=NULL)
+     {
+       const char* isCompressedExtension = strstr(ext,*extensionList);
+       if(isCompressedExtension)
+          return 1;
+        ++extensionList;
+     }
+  }
    return 0;
 }