DHDAXCW-Rockchip-OpenWrt/package/lean/open-vm-tools/patches/0009-use-posix-strerror_r-unless-on-gnu-libc-system.patch
coolsnowwolf e575061c57 Revert "move lean packages to my packages feed"
This reverts commit 510d2c3e466e953eba52c1a7c4e1d423ee10e21f.
2018-10-19 13:06:16 +08:00

29 lines
732 B
Diff

diff -urN a/open-vm-tools/lib/err/errPosix.c b/open-vm-tools/lib/err/errPosix.c
--- a/open-vm-tools/lib/err/errPosix.c
+++ b/open-vm-tools/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;
}