Fix mxb_strerror
The function should not be an inline function with a static variable. This appears to cause problems on at least Debian Wheezy and is likely to cause odd behavior on other platforms. Also renamed the file to <maxbase/string.h> to better mirror how the <string.h> file behaves.
This commit is contained in:
@ -14,16 +14,7 @@
|
||||
|
||||
#include <maxbase/cdefs.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
inline const char* mxb_strerror(int error)
|
||||
{
|
||||
// Enough for all errors
|
||||
static thread_local char errbuf[512];
|
||||
#ifdef HAVE_GLIBC
|
||||
return strerror_r(error, errbuf, sizeof(errbuf));
|
||||
#else
|
||||
strerror_r(error, errbuf, sizeof(errbuf));
|
||||
return errbuf;
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* Thread-safe strerror
|
||||
*/
|
||||
const char* mxb_strerror(int error);
|
||||
Reference in New Issue
Block a user