Commit 6cb055ae authored by yangguo@chromium.org's avatar yangguo@chromium.org
parent 2fe5a976
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netinet/in.h> #include <netinet/in.h>
...@@ -130,7 +131,10 @@ int OS::GetLastError() { ...@@ -130,7 +131,10 @@ int OS::GetLastError() {
// //
FILE* OS::FOpen(const char* path, const char* mode) { FILE* OS::FOpen(const char* path, const char* mode) {
return fopen(path, mode); struct stat file_stat;
if (stat(path, &file_stat) == 0 && (file_stat.st_mode & S_IFREG))
return fopen(path, mode);
return NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment