| Index: runtime/bin/file_win.cc
|
| diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
|
| index e5f7206b5dc5799576335c233611fd8630ec53a4..8960c6fcef24568b0bfc753f9e14745c65392a8d 100644
|
| --- a/runtime/bin/file_win.cc
|
| +++ b/runtime/bin/file_win.cc
|
| @@ -90,14 +90,11 @@ bool File::Flush() {
|
|
|
| off_t File::Length() {
|
| ASSERT(handle_->fd() >= 0);
|
| - off_t position = lseek(handle_->fd(), 0, SEEK_CUR);
|
| - if (position < 0) {
|
| - // The file is not capable of seeking. Return an error.
|
| - return -1;
|
| + struct stat st;
|
| + if (TEMP_FAILURE_RETRY(fstat(handle_->fd(), &st)) == 0) {
|
| + return st.st_size;
|
| }
|
| - off_t result = lseek(handle_->fd(), 0, SEEK_END);
|
| - lseek(handle_->fd(), position, SEEK_SET);
|
| - return result;
|
| + return -1;
|
| }
|
|
|
|
|
| @@ -157,6 +154,15 @@ bool File::Delete(const char* name) {
|
| }
|
|
|
|
|
| +off_t File::LengthFromName(const char* name) {
|
| + struct stat st;
|
| + if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) {
|
| + return st.st_size;
|
| + }
|
| + return -1;
|
| +}
|
| +
|
| +
|
| bool File::IsAbsolutePath(const char* pathname) {
|
| // Should we consider network paths?
|
| if (pathname == NULL) return false;
|
|
|