1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-01 09:47:01 +03:00

[pzstd] Check if input is a directory

This commit is contained in:
Nick Terrell
2016-09-21 16:25:08 -07:00
parent f1073c1da7
commit 5c9adff7f8

View File

@ -102,6 +102,14 @@ static FILE *openInputFile(const std::string &inputFile,
SET_BINARY_MODE(stdin);
return stdin;
}
// Check if input file is a directory
{
std::error_code ec;
if (is_directory(inputFile, ec)) {
errorHolder.setError("Output file is a directory -- ignored");
return nullptr;
}
}
auto inputFd = std::fopen(inputFile.c_str(), "rb");
if (!errorHolder.check(inputFd != nullptr, "Failed to open input file")) {
return nullptr;