From: Björn Ketelaars Date: Mon, 11 Feb 2019 23:07:32 +0000 (+0100) Subject: Make detection of symbolic links more consistent X-Git-Tag: v1.4.0^2~38^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=482b84f07bd80a917bc8a10a92b2331e680bec56;p=thirdparty%2Fzstd.git 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 --- diff --git a/programs/zstdcli.c b/programs/zstdcli.c index ef2fe2e91..794e2a811 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 */