| Index: runtime/bin/file_linux.cc
|
| diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
|
| index 6664c67956c4d6bfb986d327a26111fcf8066386..4f7ab5c3a6492849a4c3cd856aa164817e315ec2 100644
|
| --- a/runtime/bin/file_linux.cc
|
| +++ b/runtime/bin/file_linux.cc
|
| @@ -375,6 +375,12 @@ bool File::Copy(const char* old_path, const char* new_path) {
|
| int64_t File::LengthFromPath(const char* name) {
|
| struct stat64 st;
|
| if (TEMP_FAILURE_RETRY(stat64(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;
|
|
|