From: Paul Cruz Date: Wed, 21 Jun 2017 19:37:23 +0000 (-0700) Subject: added error check for when file could not be opened X-Git-Tag: v1.3.0~1^2~19^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f5fe71041d23271fc2409add38250c915b8c4ca;p=thirdparty%2Fzstd.git added error check for when file could not be opened --- diff --git a/programs/fileio.c b/programs/fileio.c index a0510f62d..634a888c1 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -875,13 +875,14 @@ typedef struct { /* * Reads information from file, stores in *info * if successful, returns 0, returns 1 for frame analysis error, returns 2 for file not compressed with zstd + * returns 3 for cases in which file could not be opened. */ static int getFileInfo(fileInfo_t* info, const char* inFileName){ int detectError = 0; FILE* const srcFile = FIO_openSrcFile(inFileName); if (srcFile == NULL) { DISPLAY("Error: could not open source file %s\n", inFileName); - return 1; + return 3; } info->compressedSize = (unsigned long long)UTIL_getFileSize(inFileName); /* begin analyzing frame */ @@ -1056,6 +1057,10 @@ static int FIO_listFile(const char* inFileName, int displayLevel, unsigned fileN } return 1; } + else if (error == 3) { + /* error occurred with opening the file */ + return 1; + } displayInfo(inFileName, &info, displayLevel); return error; }