diff options
author | Nick Terrell <terrelln@fb.com> | 2016-11-04 18:58:10 (GMT) |
---|---|---|
committer | Nick Terrell <terrelln@fb.com> | 2016-11-04 18:58:10 (GMT) |
commit | 374090c7a760a839f2ee1701620d834d1d6ae724 (patch) | |
tree | 07ed58ff6496fa8885f860cc3251bb4984518273 | |
parent | f878c08b76a58e083c47470284139f3006c8e746 (diff) | |
download | lz4-374090c7a760a839f2ee1701620d834d1d6ae724.zip lz4-374090c7a760a839f2ee1701620d834d1d6ae724.tar.gz lz4-374090c7a760a839f2ee1701620d834d1d6ae724.tar.bz2 |
Return error if input file does not exist.
Make `lz4 file-does-not-exist` return non-zero.
-rw-r--r-- | programs/lz4cli.c | 4 | ||||
-rw-r--r-- | 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 ----" |