From 374090c7a760a839f2ee1701620d834d1d6ae724 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Fri, 4 Nov 2016 11:58:10 -0700 Subject: Return error if input file does not exist. Make `lz4 file-does-not-exist` return non-zero. --- programs/lz4cli.c | 4 ++-- tests/Makefile | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/programs/lz4cli.c b/programs/lz4cli.c index a6f4b4e..f77be3d 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -550,7 +550,7 @@ int main(int argc, const char** argv) if (multiple_inputs) operationResult = LZ4IO_decompressMultipleFilenames(inFileNames, ifnIdx, LZ4_EXTENSION); else - DEFAULT_DECOMPRESSOR(input_filename, output_filename); + operationResult = DEFAULT_DECOMPRESSOR(input_filename, output_filename); } else { /* compression is default action */ if (legacy_format) { @@ -560,7 +560,7 @@ int main(int argc, const char** argv) if (multiple_inputs) operationResult = LZ4IO_compressMultipleFilenames(inFileNames, ifnIdx, LZ4_EXTENSION, cLevel); else - DEFAULT_COMPRESSOR(input_filename, output_filename, cLevel); + operationResult = DEFAULT_COMPRESSOR(input_filename, output_filename, cLevel); } } diff --git a/tests/Makefile b/tests/Makefile index 0c44b21..bfbafd8 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -221,6 +221,11 @@ test-lz4: lz4 datagen test-lz4-basic test-lz4-multiple test-lz4-sparse test-lz4- ./datagen | $(PRGDIR)/lz4 -tf && false || true ./datagen | $(PRGDIR)/lz4 -d > $(VOID) && false || true ./datagen | $(PRGDIR)/lz4 -df > $(VOID) + @echo "\n ---- test cli ----" + $(PRGDIR)/lz4 file-does-not-exist && false || true + $(PRGDIR)/lz4 -f file-does-not-exist && false || true + $(PRGDIR)/lz4 -fm file1-dne file2-dne && false || true + $(PRGDIR)/lz4 -fm file1-dne file2-dne && false || true test-lz4c: lz4c datagen @echo "\n ---- test lz4c version ----" -- cgit v0.12