Reviewers: Sven,
Message:
Hi Sven,
entspricht das in etwa deiner Vorstellung? :)
Yang
Description:
second attempt at correcting fopen (hangs when trying to read from a dir)
Please review this at http://codereview.chromium.org/7334010/
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..7514374f374d1a7db75011cd7ac04e01785384a2
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,15 @@ int OS::GetLastError() {
//
FILE* OS::FOpen(const char* path, const char* mode) {
- return fopen(path, mode);
+ FILE* file = fopen(path, mode);
+ struct stat file_stat;
+ if (file != NULL){
+ if (fstat(fileno(file), &file_stat) == 0 && (file_stat.st_mode &
S_IFREG))
+ return file;
+ else
+ fclose(file);
+ }
+ return NULL;
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev