summaryrefslogtreecommitdiffstats
path: root/programs/lz4cli.c
diff options
context:
space:
mode:
authorgabrielstedman <gabriel.stedman@zynstra.com>2019-05-25 18:57:04 (GMT)
committergabrielstedman <gabriel.stedman@zynstra.com>2019-05-26 14:04:45 (GMT)
commit729eef61a12d381f436da180329dba74b9892aa4 (patch)
tree98d4b0ae6322368f86b497628cd81c17ee353d23 /programs/lz4cli.c
parent2037af134623b85e14e3f4ef72d7457c4f6d69f3 (diff)
downloadlz4-729eef61a12d381f436da180329dba74b9892aa4.zip
lz4-729eef61a12d381f436da180329dba74b9892aa4.tar.gz
lz4-729eef61a12d381f436da180329dba74b9892aa4.tar.bz2
Handle file not existing case #704
Diffstat (limited to 'programs/lz4cli.c')
-rw-r--r--programs/lz4cli.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index c83b4cc..3619cd5 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -648,9 +648,16 @@ int main(int argc, const char** argv)
DISPLAYLEVEL(1, "refusing to read from a console\n");
exit(1);
}
- /* if input==stdin and no output defined, stdout becomes default output */
- if (!strcmp(input_filename, stdinmark) && !output_filename)
- output_filename = stdoutmark;
+ if (!strcmp(input_filename, stdinmark)) {
+ /* if input==stdin and no output defined, stdout becomes default output */
+ if (!output_filename) output_filename = stdoutmark;
+ }
+ else{
+ if (!recursive && !UTIL_isRegFile(input_filename)) {
+ DISPLAYLEVEL(1, "%s: is not a regular file \n", input_filename);
+ exit(1);
+ }
+ }
/* No output filename ==> try to select one automatically (when possible) */
while ((!output_filename) && (multiple_inputs==0)) {