This is a follow-up to the patch proposed by John Capo on april, 22.
I'm adding an autoconf check for off_t size, and then use the checked
value to conditionally enable the proposed fix.

Thank you very much, yours

        lorenzo


+-------------------------+----------------------------------------------+
|   Lorenzo M.  Catucci   | Centro di Calcolo e Documentazione           |
| [EMAIL PROTECTED] | Università degli Studi di Roma "Tor Vergata" |
|                         | Via O. Raimondo 18 ** I-00173 ROMA  ** ITALY |
|  Tel. +39 06 7259 2255  | Fax. +39 06 7259 2125                        |
+-------------------------+----------------------------------------------+
diff -r f1c01f49ce58 configure.in
--- a/configure.in	Mon May 26 13:45:47 2008 +0200
+++ b/configure.in	Tue May 27 13:31:29 2008 +0200
@@ -49,7 +49,7 @@
 AC_INIT(imap/imapd.c)
 AC_PREREQ([2.54])
 AC_CONFIG_HEADER(config.h)
-AC_CANONICAL_HOST
+AC_CANONICAL_SYSTEM
 
 dnl Useful hook for distributions
 AC_ARG_WITH(extraident,[  --with-extraident=STRING   use STRING as extra version information],
@@ -110,6 +110,9 @@
   AC_DEFINE(HAVE_LONG_LONG_INT,[],[Does the compiler support long long int?])
   AC_C_BIGENDIAN
 fi
+
+dnl Check off_t size
+AC_CHECK_SIZEOF(off_t)
 
 CMU_C___ATTRIBUTE__
 CMU_C_FPIC
@@ -989,9 +992,17 @@
 dnl add perl cccdlflags when building libraries -- this ensures that the
 dnl libraries will be compiled as PIC if perl requires PIC objects
 dnl -- this is needed on NetBSD, but seems to cause problems on atleast Solaris --
-dnl    eval `${PERL} -V:cccdlflags`
-    PERL_CCCDLFLAGS="$cccdlflags"
-    AC_SUBST(PERL_CCCDLFLAGS)
+    case "${target_os}" in
+        linux*|netbsd*)
+            AC_MSG_CHECKING(for perl cccdlflags needed on "${target_os}")
+            eval `${PERL} -V:cccdlflags`
+            PERL_CCCDLFLAGS="$cccdlflags"
+            AC_SUBST(PERL_CCCDLFLAGS)
+            AC_MSG_RESULT($PERL_CCCDLFLAGS)
+            ;;
+        *)
+            AC_MSG_WARN(skipping check for perl cccdlflags on "${target_os}")
+    esac
 fi
 
 dnl for timsieved
diff -r f1c01f49ce58 imap/statuscache_db.c
--- a/imap/statuscache_db.c	Mon May 26 13:45:47 2008 +0200
+++ b/imap/statuscache_db.c	Tue May 27 13:31:29 2008 +0200
@@ -187,7 +187,11 @@
     if (p < dend) scdata->statusitems = (unsigned) strtol(p, &p, 10);
     if (p < dend) scdata->index_mtime = strtol(p, &p, 10);
     if (p < dend) scdata->index_ino = strtoul(p, &p, 10);
+#if SIZEOF_OFF_T == 8
+    if (p < dend) scdata->index_size = strtoull(p, &p, 10);
+#else
     if (p < dend) scdata->index_size = strtoul(p, &p, 10);
+#endif
     if (p < dend) scdata->messages = strtoul(p, &p, 10);
     if (p < dend) scdata->recent = (unsigned) strtoul(p, &p, 10);
     if (p < dend) scdata->uidnext = strtoul(p, &p, 10);
@@ -233,7 +237,11 @@
     char *key = statuscache_buildkey(mboxname, userid, &keylen);
 
     datalen = snprintf(data, sizeof(data),
+#if SIZEOF_OFF_T == 8
+		       "%u %u %ld %lu %llu %lu %u %lu %lu %u " MODSEQ_FMT,
+#else
 		       "%u %u %ld %lu %lu %lu %u %lu %lu %u " MODSEQ_FMT,
+#endif
 		       STATUSCACHE_VERSION, scdata->statusitems,
 		       scdata->index_mtime, scdata->index_ino,
 		       scdata->index_size, scdata->messages,

Reply via email to