]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Make detection of symbolic links more consistent
authorBjörn Ketelaars <bjorn.ketelaars@hydroxide.nl>
Mon, 11 Feb 2019 23:07:32 +0000 (00:07 +0100)
committerBjörn Ketelaars <bjorn.ketelaars@hydroxide.nl>
Tue, 12 Feb 2019 00:56:05 +0000 (01:56 +0100)
While fixing the detection of symbolic links on OpenBSD I noticed
inconsistent behaviour:

$ echo hello > hello
$ ln -s hello world
$ zstd hello world
Warning : world is a symbolic link, ignoring
hello                :316.67%   (     6 =>     19 bytes, hello.zst
$ ls *.zst
hello.zst
$ zstd world
world                :316.67%   (     6 =>     19 bytes, world.zst)
$ ls *.zst
hello.zst world.zst

programs/zstdcli.c

index ef2fe2e91c7a53b75046c823bc463a7ac6279c4b..794e2a8111a564e47ee53ad3186e55d80d4903cc 100644 (file)
@@ -951,6 +951,8 @@ int main(int argCount, const char* argv[])
                 filenameTable[fileNamesNb++] = filenameTable[u];
             }
         }
+        if (fileNamesNb == 0 && filenameIdx > 0)
+            CLEAN_RETURN(1);
         filenameIdx = fileNamesNb;
     }
     if (recursive) {  /* at this stage, filenameTable is a list of paths, which can contain both files and directories */