summaryrefslogtreecommitdiffstats
path: root/main/fish/fish-safe-strerror.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/fish/fish-safe-strerror.patch')
-rw-r--r--main/fish/fish-safe-strerror.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/main/fish/fish-safe-strerror.patch b/main/fish/fish-safe-strerror.patch
new file mode 100644
index 000000000..e596da108
--- /dev/null
+++ b/main/fish/fish-safe-strerror.patch
@@ -0,0 +1,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)