blob: 3d1291c9fae9ed2bd8560de1660602bc2263f52b [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From d4d1e7146ca2698089f6bd532f2fb8b9c1134ca7 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Mon, 2 Jan 2017 14:39:27 +0000
4Subject: [PATCH 08/11] use posix strerror_r unless gnu
5
6---
7 open-vm-tools/lib/err/errPosix.c | 8 +++++---
8 1 file changed, 5 insertions(+), 3 deletions(-)
9
10Index: open-vm-tools/lib/err/errPosix.c
11===================================================================
12--- open-vm-tools.orig/lib/err/errPosix.c
13+++ open-vm-tools/lib/err/errPosix.c
14@@ -63,11 +63,13 @@ ErrErrno2String(Err_Number errorNumber,
15 {
16 char *p;
17
18-#if defined(linux) && !defined(N_PLAT_NLM) && !defined(__ANDROID__)
19+#if defined(__GLIBC__)
20 p = strerror_r(errorNumber, buf, bufSize);
21 #else
22- p = strerror(errorNumber);
23-#endif
24+ if (strerror_r(errorNumber, buf, bufSize) != 0)
25+ snprintf(buf, bufSize, "unknown error %i", errorNumber);
26+ p = buf;
27+#endif /* defined __GLIBC__ */
28 ASSERT(p != NULL);
29 return p;
30 }