29 lines
676 B
Diff
29 lines
676 B
Diff
|
diff -urN a/lib/err/errPosix.c b/lib/err/errPosix.c
|
||
|
--- a/lib/err/errPosix.c
|
||
|
+++ b/lib/err/errPosix.c
|
||
|
@@ -31,6 +31,7 @@
|
||
|
#include <errno.h>
|
||
|
#include <string.h>
|
||
|
#include <locale.h>
|
||
|
+#include <stdio.h>
|
||
|
|
||
|
#include "vmware.h"
|
||
|
#include "errInt.h"
|
||
|
@@ -63,11 +64,13 @@
|
||
|
{
|
||
|
char *p;
|
||
|
|
||
|
-#if defined(__linux__) && !defined(__ANDROID__)
|
||
|
+#if defined(__GLIBC__) && !defined(__ANDROID__)
|
||
|
p = strerror_r(errorNumber, buf, bufSize);
|
||
|
#else
|
||
|
- p = strerror(errorNumber);
|
||
|
-#endif
|
||
|
+ if (strerror_r(errorNumber, buf, bufSize) != 0)
|
||
|
+ snprintf(buf, bufSize, "unknown error %i", errorNumber);
|
||
|
+ p = buf;
|
||
|
+#endif /* defined __GLIBC__ */
|
||
|
ASSERT(p != NULL);
|
||
|
return p;
|
||
|
}
|