Merge pull request #715 from gabrielstedman/ret

Handle file not existing case #704
This commit is contained in:
Yann Collet 2019-05-27 11:59:23 -07:00 committed by GitHub
commit ab2248b90a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -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)) {

View File

@ -376,6 +376,7 @@ test-lz4-testmode: lz4 datagen
@echo "\n ---- non-existing source ----"
! $(LZ4) file-does-not-exist
! $(LZ4) -f file-does-not-exist
! $(LZ4) -t file-does-not-exist
! $(LZ4) -fm file1-dne file2-dne
@$(RM) tmp-tlt tmp-tlt1 tmp-tlt2 tmp-tlt2.lz4