Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detecting file as directory on zOS issue #8051 #8052

Merged
merged 3 commits into from Nov 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/google/protobuf/compiler/importer.cc
Expand Up @@ -495,10 +495,17 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenDiskFile(
do {
ret = stat(filename.c_str(), &sb);
} while (ret != 0 && errno == EINTR);
#if defined(_WIN32)
if (ret == 0 && sb.st_mode & S_IFDIR) {
last_error_message_ = "Input file is a directory.";
return NULL;
}
#else
if (ret == 0 && S_ISDIR(sb.st_mode)) {
last_error_message_ = "Input file is a directory.";
return NULL;
}
#endif
int file_descriptor;
do {
file_descriptor = open(filename.c_str(), O_RDONLY);
Expand Down