aboutsummaryrefslogtreecommitdiffstats
path: root/main/open-vm-tools/strerror_r.patch
blob: 0aea2fc6f5c9549b36d18205b66f36d874d4e6ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/open-vm-tools/lib/err/errPosix.c b/open-vm-tools/lib/err/errPosix.c
index 5091f64..294cdd6 100644
--- a/open-vm-tools/lib/err/errPosix.c
+++ b/open-vm-tools/lib/err/errPosix.c
@@ -63,11 +63,12 @@ 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);
+#endif /* defined __GLIBC__ */
    ASSERT(p != NULL);
    return p;
 }