浏览代码

Fix detecting file as directory on zOS issue #8051

Mahdi Hosseini 5 年之前
父节点
当前提交
a73c8e052d
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/google/protobuf/compiler/importer.cc

+ 1 - 1
src/google/protobuf/compiler/importer.cc

@@ -495,7 +495,7 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenDiskFile(
   do {
   do {
     ret = stat(filename.c_str(), &sb);
     ret = stat(filename.c_str(), &sb);
   } while (ret != 0 && errno == EINTR);
   } 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.";
     last_error_message_ = "Input file is a directory.";
     return NULL;
     return NULL;
   }
   }