Use strerror in uClibc, which doesn't have sys_errlist

https://github.com/fish-shell/fish-shell/pull/808
This commit is contained in:
ridiculousfish 2013-05-25 13:42:16 -07:00
parent 2eb97edf02
commit cfe815135e

View file

@ -319,6 +319,11 @@ static inline void safe_append(char *buffer, const char *s, size_t buffsize)
const char *safe_strerror(int err) const char *safe_strerror(int err)
{ {
#if defined(__UCLIBC__)
// uClibc does not have sys_errlist, however, its strerror is believed to be async-safe
// See #808
return strerror(err);
#else
if (err >= 0 && err < sys_nerr && sys_errlist[err] != NULL) if (err >= 0 && err < sys_nerr && sys_errlist[err] != NULL)
{ {
return sys_errlist[err]; return sys_errlist[err];
@ -340,6 +345,7 @@ const char *safe_strerror(int err)
errno = saved_err; errno = saved_err;
return buff; return buff;
} }
#endif
} }
void safe_perror(const char *message) void safe_perror(const char *message)