dovecot-2.0-sslstream: Added a wrapper for strptime() to work ar...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:56:35 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/0b101a864534
changeset: 10373:0b101a864534
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Nov 19 17:21:03 2009 -0500
description:
Added a wrapper for strptime() to work around issues with glibc.

diffstat:

2 files changed, 12 insertions(+)
src/lib/compat.c |    6 ++++++
src/lib/compat.h |    6 ++++++

diffs (36 lines):

diff -r b99a19d5a93c -r 0b101a864534 src/lib/compat.c
--- a/src/lib/compat.c	Thu Nov 19 14:19:39 2009 -0500
+++ b/src/lib/compat.c	Thu Nov 19 17:21:03 2009 -0500
@@ -17,6 +17,7 @@
 #include <ctype.h>
 #include <unistd.h>
 #include <syslog.h>
+#include <time.h>
 #include <sys/time.h>
 #ifdef HAVE_INTTYPES_H
 #  include <inttypes.h> /* for strtoimax() and strtoumax() */
@@ -307,3 +308,8 @@ int i_my_clock_gettime(int clk_id, struc
 	return 0;
 }
 #endif
+
+char *my_strptime(const char *s, const char *format, struct tm *tm)
+{
+	return strptime(s, format, tm);
+}
diff -r b99a19d5a93c -r 0b101a864534 src/lib/compat.h
--- a/src/lib/compat.h	Thu Nov 19 14:19:39 2009 -0500
+++ b/src/lib/compat.h	Thu Nov 19 17:21:03 2009 -0500
@@ -206,6 +206,12 @@ int i_my_vsnprintf(char *str, size_t siz
 #  define clock_gettime i_my_clock_gettime
 int i_my_clock_gettime(int clk_id, struct timespec *tp);
 #endif
+
+/* glibc wants _XOPEN_SOURCE defined for strptime(), but doing that breaks
+   other things. So we'll create this wrapper to work around the problems. */
+#define strptime my_strptime
+struct tm;
+char *my_strptime(const char *s, const char *format, struct tm *tm);
 
 /* ctype.h isn't safe with signed chars,
    use our own instead if really needed */


More information about the dovecot-cvs mailing list