| Index: runtime/bin/file_fuchsia.cc
|
| diff --git a/runtime/bin/file_fuchsia.cc b/runtime/bin/file_fuchsia.cc
|
| index ceea0c3d6f37d10fee47b9b0e689dc27ed182079..65d4962678f958f9c0ea376d65f74136ef051761 100644
|
| --- a/runtime/bin/file_fuchsia.cc
|
| +++ b/runtime/bin/file_fuchsia.cc
|
| @@ -347,6 +347,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;
|
|
|