|
|
@ -495,10 +495,17 @@ 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 defined(_WIN32) |
|
|
|
|
|
|
|
if (ret == 0 && sb.st_mode & S_IFDIR) { |
|
|
|
|
|
|
|
last_error_message_ = "Input file is a directory."; |
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#elif |
|
|
|
if (ret == 0 && S_ISDIR(sb.st_mode)) { |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
int file_descriptor; |
|
|
|
int file_descriptor; |
|
|
|
do { |
|
|
|
do { |
|
|
|
file_descriptor = open(filename.c_str(), O_RDONLY); |
|
|
|
file_descriptor = open(filename.c_str(), O_RDONLY); |
|
|
|