From 482b84f07bd80a917bc8a10a92b2331e680bec56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ketelaars?= Date: Tue, 12 Feb 2019 00:07:32 +0100 Subject: [PATCH] Make detection of symbolic links more consistent 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/programs/zstdcli.c b/programs/zstdcli.c index ef2fe2e9..794e2a81 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -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 */