packages/utils/open-vm-tools/patches/0009-use-posix-strerror_r-unless-on-gnu-libc-system.patch
Yuhei OKAWA 48eadd2ffd open-vm-tools: Add new package open-vm-tools
Add new package,
open-vm-tools is Open Virtual Machine Tools for VMware guest OS

tested: OpenWrt master and 18.06.2 (x86_64) on ESXi 6.5, 6.7

Signed-off-by: Yuhei OKAWA <tochiro.srchack@gmail.com>
2019-02-25 13:47:01 +08:00

28 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;
}