| Index: runtime/platform/utils_linux.h
|
| diff --git a/runtime/platform/utils_linux.h b/runtime/platform/utils_linux.h
|
| index f2af4d15b6f9d2e83644df1bcd8ec27fe942716a..bb9594fbdbd65589cfb29dbe2104bb0a5e3ba63f 100644
|
| --- a/runtime/platform/utils_linux.h
|
| +++ b/runtime/platform/utils_linux.h
|
| @@ -60,6 +60,21 @@ inline uint64_t Utils::HostToLittleEndian64(uint64_t value) {
|
| return htole64(value);
|
| }
|
|
|
| +
|
| +inline char* Utils::StrError(int err, char* buffer, size_t bufsize) {
|
| +#if !defined(__GLIBC__) || \
|
| +((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
|
| + // Use the XSI version.
|
| + if (strerror_r(err, buffer, bufsize) != 0) {
|
| + snprintf(buffer, bufsize, "%s", "strerror_r failed");
|
| + }
|
| + return buffer;
|
| +#else
|
| + // Use the GNU specific version.
|
| + return strerror_r(err, buffer, bufsize);
|
| +#endif
|
| +}
|
| +
|
| } // namespace dart
|
|
|
| #endif // PLATFORM_UTILS_LINUX_H_
|
|
|