summaryrefslogtreecommitdiff
path: root/libc/debian/patches
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-03-08 16:45:30 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-03-08 16:45:30 +0000
commit2fa18814ceb8b3f1a1e932787544ce37eb43f9f2 (patch)
treef675d2db6b04268dcc264fcea034dbfb1010014f /libc/debian/patches
parent6e737241068f322888f27c27bce2026affe14025 (diff)
downloadillumos-packaging-2fa18814ceb8b3f1a1e932787544ce37eb43f9f2.tar.gz
Implement GNU version on strerror_r()
Diffstat (limited to 'libc/debian/patches')
-rw-r--r--libc/debian/patches/libc-add-gnu-strerror_r.patch58
-rw-r--r--libc/debian/patches/series1
2 files changed, 59 insertions, 0 deletions
diff --git a/libc/debian/patches/libc-add-gnu-strerror_r.patch b/libc/debian/patches/libc-add-gnu-strerror_r.patch
new file mode 100644
index 0000000..8e7736f
--- /dev/null
+++ b/libc/debian/patches/libc-add-gnu-strerror_r.patch
@@ -0,0 +1,58 @@
+Index: libc/usr/src/lib/libc/port/gen/strerror.c
+===================================================================
+--- libc.orig/usr/src/lib/libc/port/gen/strerror.c 2013-03-08 15:52:02.100462790 +0000
++++ libc/usr/src/lib/libc/port/gen/strerror.c 2013-03-08 16:18:12.178735452 +0000
+@@ -31,6 +31,7 @@
+
+ #include "lint.h"
+ #include "_libc_gettext.h"
++#include <stdio.h>
+ #include <string.h>
+ #include <sys/types.h>
+ #include <errno.h>
+@@ -77,3 +78,14 @@
+
+ return (ret);
+ }
++
++char *
++gnu_strerror_r(int errnum, char *buf, size_t buflen)
++{
++ if (errnum < 0 || errnum >= _sys_num_err) {
++ const char *unknown = _libc_gettext("Unknown error");
++ (void) snprintf(buf, buflen, "%s %d", unknown, errnum);
++ return buf;
++ }
++ return _libc_gettext((char *)&_sys_errs[_sys_index[errnum]]);
++}
+Index: libc/usr/src/lib/libc/port/mapfile-vers
+===================================================================
+--- libc.orig/usr/src/lib/libc/port/mapfile-vers 2013-03-08 11:13:58.650560001 +0000
++++ libc/usr/src/lib/libc/port/mapfile-vers 2013-03-08 16:19:02.950245784 +0000
+@@ -98,6 +98,7 @@
+ error_one_per_line;
+ error_print_progname;
+ flock;
++ gnu_strerror_r;
+ mempcpy;
+ memrchr;
+ program_invocation_name;
+Index: libc/usr/src/head/string.h
+===================================================================
+--- libc.orig/usr/src/head/string.h 2013-03-08 01:36:30.330472304 +0000
++++ libc/usr/src/head/string.h 2013-03-08 16:22:30.633485968 +0000
+@@ -70,7 +70,14 @@
+ #if defined(__EXTENSIONS__) || \
+ (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
+ defined(_XPG6) || defined(_REENTRANT)
++
++#ifdef _GNU_SOURCE
++extern char *gnu_strerror_r(int, char*, size_t);
++#define strerror_r gnu_strerror_r
++#else /* !_GNU_SOURCE */
+ extern int strerror_r(int, char *, size_t);
++#endif /* _GNU_SOURCE */
++
+ #endif
+
+ #if defined(__EXTENSIONS__) || \
diff --git a/libc/debian/patches/series b/libc/debian/patches/series
index f63b011..b8e6eff 100644
--- a/libc/debian/patches/series
+++ b/libc/debian/patches/series
@@ -73,3 +73,4 @@ libc-add-wmempcpy.patch
stdio.h-includes-features.h.patch
libc-add-tdestroy.patch
rpcinfo-MAX.patch
+libc-add-gnu-strerror_r.patch