| Index: runtime/bin/file_macos.cc
|
| diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc
|
| index d1259f757fc3d875b80339b98434b06dca10553b..401b6870158f7e8db916d1942b17a87cc0aec94e 100644
|
| --- a/runtime/bin/file_macos.cc
|
| +++ b/runtime/bin/file_macos.cc
|
| @@ -333,6 +333,12 @@ bool File::Copy(const char* old_path, const char* new_path) {
|
| int64_t File::LengthFromPath(const char* name) {
|
| struct stat st;
|
| if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
|
| + // Signal an error if it's a directory.
|
| + if (S_ISDIR(st.st_mode)) {
|
| + errno = EISDIR;
|
| + return -1;
|
| + }
|
| + // Otherwise assume the caller knows what it's doing.
|
| return st.st_size;
|
| }
|
| return -1;
|
|
|