dovecot: Don't use posix_fallocate() with GLIBC versions older t...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jan 16 18:24:13 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/d349cdeddc7d
changeset: 7164:d349cdeddc7d
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jan 16 18:24:09 2008 +0200
description:
Don't use posix_fallocate() with GLIBC versions older than 2.7. It probably
works with a bit older versions, but at least in 2.3.5 it can cause infinite
loops.

diffstat:

1 file changed, 14 insertions(+), 1 deletion(-)
configure.in |   15 ++++++++++++++-

diffs (32 lines):

diff -r b7fc50c68c35 -r d349cdeddc7d configure.in
--- a/configure.in	Tue Jan 15 18:16:06 2008 +0200
+++ b/configure.in	Wed Jan 16 18:24:09 2008 +0200
@@ -431,7 +431,7 @@ AC_CHECK_FUNCS(fcntl flock lockf inet_at
 	       setrlimit setproctitle seteuid setreuid setegid setresgid \
 	       strtoull strtouq setpriority quotactl getmntent kqueue kevent \
 	       backtrace_symbols walkcontext dirfd \
-	       malloc_usable_size posix_fallocate)
+	       malloc_usable_size)
 
 dnl * I/O loop function
 have_ioloop=no
@@ -594,6 +594,19 @@ AC_TRY_COMPILE([
   #endif
 ],,, [
   AC_DEFINE(PREAD_WRAPPERS,, Define if pread/pwrite needs _XOPEN_SOURCE 500)
+])
+
+dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it.
+AC_TRY_COMPILE([
+  #define _XOPEN_SOURCE 600
+  #include <stdlib.h>
+  #if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 7)
+    possibly broken posix_fallocate
+  #endif
+], [
+  posix_fallocate(0, 0, 0);
+], [
+  AC_DEFINE(HAVE_POSIX_FALLOCATE,, Define if you have a working posix_fallocate())
 ])
 
 dnl * OS specific options


More information about the dovecot-cvs mailing list