Skip to content

Commit da913e9

Browse files
committed
lib-imap: fix for systems with signed 32-bit time_t
The code and tests have some hard-coded values based on the size of time_t but they don't take into account whether or not time_t is a signed value. On systems such as i686 with time_t as a signed 32-bit integer, the maximum value is the same as an unsigned 31-bit integer. Tweak the configure test to treat 32-bit signed as 31 bits.
1 parent 6e065b7 commit da913e9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

m4/gmtime_max.m4

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
dnl * how large time_t values does gmtime() accept?
22
AC_DEFUN([DOVECOT_GMTIME_MAX], [
3+
AC_REQUIRE([DOVECOT_TIME_T])
34
AC_CACHE_CHECK([how large time_t values gmtime() accepts],i_cv_gmtime_max_time_t,[
45
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
56
#include <stdio.h>
@@ -20,6 +21,12 @@ AC_DEFUN([DOVECOT_GMTIME_MAX], [
2021
Let's just do the same as Cyrus folks and limit it to 40 bits. */
2122
bits = 40;
2223
}
24+
#ifdef TIME_T_SIGNED
25+
if (bits == 32) {
26+
/* Signed 32-bit time_t is essentially the same as unsigned 31-bit time_t */
27+
bits = 31;
28+
}
29+
#endif
2330
2431
f = fopen("conftest.temp", "w");
2532
if (f == NULL) {

0 commit comments

Comments
 (0)