]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added a wrapper for strptime() to work around issues with glibc.
authorTimo Sirainen <tss@iki.fi>
Thu, 19 Nov 2009 22:21:03 +0000 (17:21 -0500)
committerTimo Sirainen <tss@iki.fi>
Thu, 19 Nov 2009 22:21:03 +0000 (17:21 -0500)
--HG--
branch : HEAD

src/lib/compat.c
src/lib/compat.h

index dbafd237061c738d747ea7d64a1640dc3b1dad26..75ec839a3320993dfa837f8a3c68bad2b7eaea8c 100644 (file)
@@ -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, struct timespec *tp)
        return 0;
 }
 #endif
+
+char *my_strptime(const char *s, const char *format, struct tm *tm)
+{
+       return strptime(s, format, tm);
+}
index b46bb60fa174b595adc25dbb43c219cb82821364..92c1965a585eb3df527e0ab7b4c943b81c7f3bdb 100644 (file)
@@ -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)))