From a73c8e052dcb2931e6f6d5cc6606496ac6764bdb Mon Sep 17 00:00:00 2001 From: Mahdi Hosseini Date: Mon, 16 Nov 2020 17:13:53 -0500 Subject: [PATCH] Fix detecting file as directory on zOS issue #8051 --- src/google/protobuf/compiler/importer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/compiler/importer.cc b/src/google/protobuf/compiler/importer.cc index 1ff8aadc6fe..c6a8d1eaf38 100644 --- a/src/google/protobuf/compiler/importer.cc +++ b/src/google/protobuf/compiler/importer.cc @@ -495,7 +495,7 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenDiskFile( 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; }