summaryrefslogtreecommitdiffstats
path: root/main/fish/fish-safe-strerror.patch
blob: e596da108b9262ee98173dade604a10b1c62f026 (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
--- fish/wutil.cpp
+++ fish.orig/wutil.cpp
@@ -319,27 +319,7 @@
 
 const char *safe_strerror(int err)
 {
-    if (err >= 0 && err < sys_nerr && sys_errlist[err] != NULL)
-    {
-        return sys_errlist[err];
-    }
-    else
-    {
-        int saved_err = errno;
-
-        /* Use a shared buffer for this case */
-        static char buff[384];
-        char errnum_buff[64];
-        format_long_safe(errnum_buff, err);
-
-        buff[0] = '\0';
-        safe_append(buff, "unknown error (errno was ", sizeof buff);
-        safe_append(buff, errnum_buff, sizeof buff);
-        safe_append(buff, ")", sizeof buff);
-
-        errno = saved_err;
-        return buff;
-    }
+    return strerror(err);
 }
 
 void safe_perror(const char *message)