mirror of
https://github.com/facebook/zstd.git
synced 2025-03-07 01:10:04 +02:00
added error check for when file could not be opened
This commit is contained in:
parent
74a725da69
commit
6f5fe71041
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user