]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Gating named file support on windows
authorBimba Shrestha <bimbashrestha@fb.com>
Fri, 25 Oct 2019 18:32:38 +0000 (11:32 -0700)
committerBimba Shrestha <bimbashrestha@fb.com>
Fri, 25 Oct 2019 18:32:38 +0000 (11:32 -0700)
programs/fileio.c
programs/zstdcli.c
tests/playTests.sh

index d45e4bbda1f90092af9b9d8756091b94efd4ec76..20868b9b8e8f354c9ab66817647b0ab0db0b7f7e 100644 (file)
@@ -513,12 +513,24 @@ static FILE* FIO_openSrcFile(const char* srcFileName)
         return NULL;
     }
 
+#ifdef _MSC_VER
+
+    if (!UTIL_isRegularFile(srcFileName)) {
+        DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n",
+                        srcFileName);
+        return NULL;
+    }
+
+#else
+
     if (!UTIL_isRegularFile(srcFileName) && !UTIL_isFIFO(srcFileName)) {
         DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n",
                         srcFileName);
         return NULL;
     }
 
+#endif /* _MSC_VER */
+
     {   FILE* const f = fopen(srcFileName, "rb");
         if (f == NULL)
             DISPLAYLEVEL(1, "zstd: %s: %s \n", srcFileName, strerror(errno));
index 7a0fa6a25589eaad5020c26b2a3df52398685528..66b7ae5d2e336a5afb38cafe9039e367431ecc1c 100644 (file)
@@ -992,11 +992,25 @@ int main(int argCount, const char* argv[])
     if (!followLinks) {
         unsigned u;
         for (u=0, fileNamesNb=0; u<filenameIdx; u++) {
+
+#ifdef _MSC_VER
+
+            if (UTIL_isLink(filenameTable[u])) {
+                DISPLAYLEVEL(2, "Warning : %s is a symbolic link, ignoring\n", filenameTable[u]);
+            } else {
+                filenameTable[fileNamesNb++] = filenameTable[u];
+            }
+
+#else
+
             if (UTIL_isLink(filenameTable[u]) && !UTIL_isFIFO(filenameTable[u])) {
                 DISPLAYLEVEL(2, "Warning : %s is a symbolic link, ignoring\n", filenameTable[u]);
             } else {
                 filenameTable[fileNamesNb++] = filenameTable[u];
             }
+
+#endif /* _MSC_VER */
+
         }
         if (fileNamesNb == 0 && filenameIdx > 0)
             CLEAN_RETURN(1);
index 29ac1faa5547551bd565959194367f1c0e43438d..036318a5404163ffa8310027f36a8d25091f5e74 100755 (executable)
@@ -1080,6 +1080,8 @@ test -f dictionary
 rm -f tmp* dictionary
 
 
+if [ "$isWindows" = false ] ; then
+
 println "\n===>  zstd fifo named pipe test "
 head -c 10 /dev/zero > tmp_original
 mkfifo named_pipe
@@ -1090,4 +1092,6 @@ $DIFF -s tmp_original tmp_decompressed
 rm -rf tmp*
 rm -rf named_pipe
 
+fi
+
 rm -f tmp*