Fix detecting file as directory on zOS issue #8051
diff --git a/src/google/protobuf/compiler/importer.cc b/src/google/protobuf/compiler/importer.cc
index 1ff8aad..c6a8d1e 100644
--- a/src/google/protobuf/compiler/importer.cc
+++ b/src/google/protobuf/compiler/importer.cc
@@ -495,7 +495,7 @@
do {
ret = stat(filename.c_str(), &sb);
} while (ret != 0 && errno == EINTR);
- if (ret == 0 && sb.st_mode & S_IFDIR) {
+ if (ret == 0 && S_ISDIR(sb.st_mode)) {
last_error_message_ = "Input file is a directory.";
return NULL;
}