mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-20 02:07:56 +00:00
generalise strerror_r preprocessor switch (#1026)
same approach as in https://reviews.llvm.org/D25071
This commit is contained in:
parent
d32d2fbfb7
commit
f5dfde33d0
2 changed files with 2 additions and 4 deletions
|
|
@ -236,10 +236,9 @@ void LoopDir(const std::string& dir_name, T func) {
|
|||
auto e = errno;
|
||||
char buf[1024];
|
||||
char* msg;
|
||||
#if defined(_GNU_SOURCE) && !defined(__APPLE__)
|
||||
#if defined(__GLIBC__) && defined(_GNU_SOURCE)
|
||||
msg = strerror_r(e, buf, sizeof(buf));
|
||||
#else
|
||||
// for Mac OS X
|
||||
if (strerror_r(e, buf, sizeof(buf)) != 0) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,10 +180,9 @@ class PosixEnv : public Env {
|
|||
char buf[1024];
|
||||
const char* msg = "";
|
||||
if (e > 0) {
|
||||
#if defined(_GNU_SOURCE) && !defined(__APPLE__)
|
||||
#if defined(__GLIBC__) && defined(_GNU_SOURCE)
|
||||
msg = strerror_r(e, buf, sizeof(buf));
|
||||
#else
|
||||
// for Mac OS X
|
||||
if (strerror_r(e, buf, sizeof(buf)) != 0) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue