Index: runtime/bin/file_macos.cc |
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc |
index 3cf40de61fc5267b8221b07b2669f4a38ebc8249..7b3815aa0feeb8baf3ce9814ac10133911f996a0 100644 |
--- a/runtime/bin/file_macos.cc |
+++ b/runtime/bin/file_macos.cc |
@@ -319,7 +319,10 @@ File::StdioHandleType File::GetStdioHandleType(int fd) { |
struct stat buf; |
int result = fstat(fd, &buf); |
if (result == -1) { |
- FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); |
+ const int kBufferSize = 1024; |
+ char error_message[kBufferSize]; |
+ strerror_r(errno, error_message, kBufferSize); |
+ FATAL2("Failed stat on file descriptor %d: %s", fd, error_message); |
} |
if (S_ISCHR(buf.st_mode)) return kTerminal; |
if (S_ISFIFO(buf.st_mode)) return kPipe; |