summaryrefslogtreecommitdiff
path: root/common/compat.c
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-03-18 22:27:48 +0100
committerStef Walter <stefw@gnome.org>2013-03-18 22:38:29 +0100
commitcaaeaffb86c572f996bec31f67443da2219def84 (patch)
treeddd589a2ca877fc26bfd62c96ac1179edde431cc /common/compat.c
parent6c47831b3bfc66e1e995fb27e80c23085bb41e08 (diff)
downloadp11-kit-caaeaffb86c572f996bec31f67443da2219def84.tar.gz
Release version 0.17.10.17.1
* Fix distcheck bugs surrounding the strndup() workaround
Diffstat (limited to 'common/compat.c')
-rw-r--r--common/compat.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/common/compat.c b/common/compat.c
index 4a6edb1..4e99d11 100644
--- a/common/compat.c
+++ b/common/compat.c
@@ -424,7 +424,27 @@ memdup (const void *data,
#endif /* HAVE_MEMDUP */
-#ifndef HAVE_STRNDUP
+/*
+ * WORKAROUND: So in lots of released builds of firefox a completely broken strndup()
+ * is present. It does not NULL terminate its string output. It is unconditionally
+ * defined, and overrides the libc strndup() function on platforms where it
+ * exists as a function. For this reason we (for now) unconditionally define
+ * strndup().
+ */
+
+#if 1 /* #ifndef HAVE_STRNDUP */
+
+/*
+ * HAVE_STRNDUP may be undefined if strndup() isn't working. So it may be
+ * present, and yet strndup may still be a defined header macro.
+ */
+#ifdef strndup
+#undef strndup
+#endif
+
+char *
+strndup (const char *data,
+ size_t length);
char *
strndup (const char *data,