| Index: runtime/bin/file_android.cc
|
| diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc
|
| index 985fbf8cd9d13b97bacc3072c91e5e520c23387f..993032f74e9aa6bacf96827dd26c021f3f605d1f 100644
|
| --- a/runtime/bin/file_android.cc
|
| +++ b/runtime/bin/file_android.cc
|
| @@ -373,6 +373,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;
|
|
|