summaryrefslogtreecommitdiff
path: root/user/open-vm-tools/strerror_r.patch
blob: 05de85f7accb7c76416110513dc376672ef7e41c (plain) (blame)
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
--- open-vm-tools-12.4.0-23259341/lib/err/errPosix.c.old	2024-02-06 09:08:54.000000000 -0600
+++ open-vm-tools-12.4.0-23259341/lib/err/errPosix.c	2024-05-22 13:58:47.578938258 -0500
@@ -29,6 +29,7 @@
 #endif
 
 #include <errno.h>
+#include <stdio.h>
 #include <string.h>
 #include <locale.h>
 
@@ -63,10 +64,12 @@
 {
    char *p;
 
-#if defined(__linux__) && !defined(__ANDROID__)
+#if defined(__linux__) && defined(__GLIBC__)
    p = strerror_r(errorNumber, buf, bufSize);
 #else
-   p = strerror(errorNumber);
+   if(strerror_r(errorNumber, buf, bufSize) != 0)
+      snprintf(buf, bufSize, "unknown error %i", errorNumber);
+   p = buf;
 #endif
    ASSERT(p != NULL);
    return p;