aboutsummaryrefslogtreecommitdiffstats
path: root/main/mariadb/0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-08-24 13:46:44 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2015-08-24 13:47:33 +0200
commit5ab93db828102c862e326c393fb326d6fc78a2bb (patch)
tree2ff5cd119bf9d371c89c2ec682f9e41cc69d9da7 /main/mariadb/0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch
parent135d8013df15461ced3b88fd9f3fc3d03c1d7c65 (diff)
downloadaports-5ab93db828102c862e326c393fb326d6fc78a2bb.tar.bz2
aports-5ab93db828102c862e326c393fb326d6fc78a2bb.tar.xz
main/mariadb: fix segfault due to strerror_r
Diffstat (limited to 'main/mariadb/0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch')
-rw-r--r--main/mariadb/0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/main/mariadb/0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch b/main/mariadb/0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch
new file mode 100644
index 0000000000..219cddc52a
--- /dev/null
+++ b/main/mariadb/0001-Fix-segfault-with-musl-libc-due-to-bad-use-of-strerr.patch
@@ -0,0 +1,37 @@
+From 790b56fcbce73e3335565eb1d8f0cdab5e596dba Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon, 24 Aug 2015 11:55:59 +0200
+Subject: [PATCH] Fix segfault with musl libc due to bad use of strerror_r
+
+The only known implementation that has the GNU variand of strerror_r is
+GNU libc. Building with musl libc and _GNU_SOURCE enables some other gnu
+extensions, but musl libc does not implement the broken strerror_r.
+
+We fix thsi by check explicitly for GNU libc in addition to _GNU_SOURCE
+and if they both are not set, then fall back to standard.
+
+This fixes segfault with musl libc.
+---
+ strings/my_vsnprintf.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
+index 1584a9e..4a10413 100644
+--- a/strings/my_vsnprintf.c
++++ b/strings/my_vsnprintf.c
+@@ -827,11 +827,7 @@ void my_strerror(char *buf, size_t len, int nr)
+ */
+ #if defined(__WIN__)
+ strerror_s(buf, len, nr);
+-#elif ((defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE >= 200112L)) || \
+- (defined _XOPEN_SOURCE && (_XOPEN_SOURCE >= 600))) && \
+- ! defined _GNU_SOURCE
+- strerror_r(nr, buf, len); /* I can build with or without GNU */
+-#elif defined _GNU_SOURCE
++#elif defined(__GLIBC__) && defined(_GNU_SOURCE)
+ char *r= strerror_r(nr, buf, len);
+ if (r != buf) /* Want to help, GNU? */
+ strmake(buf, r, len - 1); /* Then don't. */
+--
+2.5.0
+