summaryrefslogtreecommitdiffstats
path: root/programs/lz4cli.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2022-07-01 08:36:32 (GMT)
committerYann Collet <cyan@fb.com>2022-07-01 08:36:32 (GMT)
commit35565bf0dc118c8825c437ec320572b6c78a2a3e (patch)
tree1a20426c2ba4885c78aa48c39227f1d90f98e1d7 /programs/lz4cli.c
parent24b50935f9d56bb82214961dbcbd83f8c296b44b (diff)
downloadlz4-35565bf0dc118c8825c437ec320572b6c78a2a3e.zip
lz4-35565bf0dc118c8825c437ec320572b6c78a2a3e.tar.gz
lz4-35565bf0dc118c8825c437ec320572b6c78a2a3e.tar.bz2
refactored logic to test special file names
Diffstat (limited to 'programs/lz4cli.c')
-rw-r--r--programs/lz4cli.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 6302505..26148ee 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -654,17 +654,19 @@ int main(int argc, const char** argv)
mode = om_decompress; /* defer to decompress */
}
- /* compress or decompress */
+ /* No input provided => use stdin */
if (!input_filename) input_filename = stdinmark;
- /* Check if input is defined as console; trigger an error in this case */
+
+ /* Refuse to use the console as input */
if (!strcmp(input_filename, stdinmark) && IS_CONSOLE(stdin) ) {
DISPLAYLEVEL(1, "refusing to read from a console\n");
exit(1);
}
+
if (!strcmp(input_filename, stdinmark)) {
/* if input==stdin and no output defined, stdout becomes default output */
if (!output_filename) output_filename = stdoutmark;
- } else {
+ } else { /* input != stdin, so it's a file name */
#ifdef UTIL_HAS_CREATEFILELIST
if (!recursive && !UTIL_isRegFile(input_filename)) {
#else