From: Timo Sirainen Date: Thu, 19 Nov 2009 22:21:03 +0000 (-0500) Subject: Added a wrapper for strptime() to work around issues with glibc. X-Git-Tag: 2.0.beta1~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=405f9be6a8fbd703cf2e4bf4e7f036aa1d9b42d6;p=thirdparty%2Fdovecot%2Fcore.git Added a wrapper for strptime() to work around issues with glibc. --HG-- branch : HEAD --- diff --git a/src/lib/compat.c b/src/lib/compat.c index dbafd23706..75ec839a33 100644 --- a/src/lib/compat.c +++ b/src/lib/compat.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #ifdef HAVE_INTTYPES_H # include /* for strtoimax() and strtoumax() */ @@ -307,3 +308,8 @@ int i_my_clock_gettime(int clk_id, struct timespec *tp) return 0; } #endif + +char *my_strptime(const char *s, const char *format, struct tm *tm) +{ + return strptime(s, format, tm); +} diff --git a/src/lib/compat.h b/src/lib/compat.h index b46bb60fa1..92c1965a58 100644 --- a/src/lib/compat.h +++ b/src/lib/compat.h @@ -207,6 +207,12 @@ int i_my_vsnprintf(char *str, size_t size, const char *format, va_list ap); 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 */ #define i_toupper(x) ((char) toupper((int) (unsigned char) (x)))