mirror of
https://github.com/rafaelvcaetano/melonDS-android-lib.git
synced 2024-11-26 23:21:12 +00:00
Simplify usage of strerror_r
This commit is contained in:
parent
f1080b5160
commit
2de14f7cb5
@ -29,12 +29,12 @@ std::string LastStrerrorString()
|
||||
// We check defines in order to figure out variant is in use, and we store the returned value
|
||||
// to a variable so that we'll get a compile-time check that our assumption was correct.
|
||||
|
||||
#if defined(__GLIBC__) && (_GNU_SOURCE || (_POSIX_C_SOURCE < 200112L && _XOPEN_SOURCE < 600))
|
||||
#if (_GNU_SOURCE)
|
||||
const char* str = strerror_r(errno, error_message, BUFFER_SIZE);
|
||||
return std::string(str);
|
||||
#else
|
||||
const char* str = strerror_r(errno, error_message, BUFFER_SIZE);
|
||||
return std::string(str);
|
||||
int error_code = strerror_r(errno, error_message, BUFFER_SIZE);
|
||||
return error_code == 0 ? std::string(error_message) : "";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user