Add file missing from commit baf099 "Fix glibc 2.7 strtok_r() bug...".
authorBen Pfaff <blp@nicira.com>
Wed, 10 Jun 2009 23:45:02 +0000 (16:45 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 10 Jun 2009 23:45:02 +0000 (16:45 -0700)
Oops.

lib/string.h [new file with mode: 0644]

diff --git a/lib/string.h b/lib/string.h
new file mode 100644 (file)
index 0000000..9a13f05
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef STRING_WRAPPER_H
+#define STRING_WRAPPER_H 1
+
+#include_next <string.h>
+
+/* Glibc 2.7 has a bug in strtok_r when compiling with optimization that can
+ * cause segfaults if the delimiters argument is a compile-time constant that
+ * has exactly 1 character:
+ *
+ *      http://sources.redhat.com/bugzilla/show_bug.cgi?id=5614
+ *
+ * The bug is only present in the inline version of strtok_r(), so force the
+ * out-of-line version to be used instead. */
+#if HAVE_STRTOK_R_BUG
+#undef strtok_r
+#endif
+
+#endif /* string.h wrapper */