Index: runtime/bin/file_fuchsia.cc |
diff --git a/runtime/bin/file_fuchsia.cc b/runtime/bin/file_fuchsia.cc |
index 65d4962678f958f9c0ea376d65f74136ef051761..1c2fe03f0d36aebc68d3de3335a2fcde5a931e0c 100644 |
--- a/runtime/bin/file_fuchsia.cc |
+++ b/runtime/bin/file_fuchsia.cc |
@@ -385,6 +385,12 @@ void File::Stat(const char* name, int64_t* data) { |
time_t File::LastModified(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_mtime; |
} |
return -1; |