Reviewers: Mads Ager,
Message:
Fixed issue http://code.google.com/p/v8/issues/detail?id=1533
however only for POSIX systems. It would be interesting to see whether this
is
also an issue on Windows. It uses fopen_s to open a file in Windows as
opposed
to fopen. Unfortunately I don't have a Windows box at my disposal.
http://codereview.chromium.org/7335007/diff/1/src/platform-posix.cc
File src/platform-posix.cc (right):
http://codereview.chromium.org/7335007/diff/1/src/platform-posix.cc#newcode135
src/platform-posix.cc:135: if (stat(path, &file_stat) == 0 &&
(file_stat.st_mode & S_IFREG))
check whether the file to be opened is a regular (S_IFREG) file before
actually trying to open it.
Description:
bug fix
BUG=http://code.google.com/p/v8/issues/detail?id=1533
Please review this at http://codereview.chromium.org/7335007/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/platform-posix.cc
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))
+ return fopen(path, mode);
+ return NULL;
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev