aboutsummaryrefslogtreecommitdiffstats
path: root/main/open-vm-tools/0012-use-posix-strerror_r-unless-gnu.patch
blob: 4d3319f08e35cef994e0d473865bf95bce8da3dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From f69bf0fb95f8db126ffcffe5c1a59a955d778a3e Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 2 Jan 2017 14:39:27 +0000
Subject: [PATCH 12/14] use posix strerror_r unless gnu

---
 open-vm-tools/lib/err/errPosix.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/open-vm-tools/lib/err/errPosix.c b/open-vm-tools/lib/err/errPosix.c
index 37b45237..63ca9dd7 100644
--- a/open-vm-tools/lib/err/errPosix.c
+++ b/open-vm-tools/lib/err/errPosix.c
@@ -63,11 +63,13 @@ ErrErrno2String(Err_Number errorNumber, // IN
 {
    char *p;
 
-#if defined(linux) && !defined(N_PLAT_NLM) && !defined(__ANDROID__)
+#if defined(__GLIBC__)
    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;
 }
-- 
2.11.0