Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Unified Diff: src/platform-posix.cc

Issue 7335007: bug fix (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-posix.cc
diff --git a/src/platform-posix.cc b/src/platform-posix.cc
index 83f6c8112edf0732e4de957779e393d13d2deda3..c53881a244fb786e9d649ad8664f941262dd7c6c 100644
--- a/src/platform-posix.cc
+++ b/src/platform-posix.cc
@@ -37,6 +37,7 @@
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@@ -130,7 +131,10 @@ int OS::GetLastError() {
//
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))
Yang 2011/07/11 13:40:52 check whether the file to be opened is a regular (
+ return fopen(path, mode);
+ return NULL;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698