dovecot-2.2: lib-fs: Compile fix for OSes that don't support pos...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 29 16:51:56 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/0b4b2e37b793
changeset: 15279:0b4b2e37b793
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 29 16:51:46 2012 +0200
description:
lib-fs: Compile fix for OSes that don't support posix_fadvise(POSIX_FADV_WILLNEED)

diffstat:

 src/lib-fs/fs-posix.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r 12cd194553a8 -r 0b4b2e37b793 src/lib-fs/fs-posix.c
--- a/src/lib-fs/fs-posix.c	Mon Oct 29 15:32:44 2012 +0200
+++ b/src/lib-fs/fs-posix.c	Mon Oct 29 16:51:46 2012 +0200
@@ -286,7 +286,7 @@
 	i_free(file);
 }
 
-static bool fs_posix_prefetch(struct fs_file *_file, uoff_t length)
+static bool fs_posix_prefetch(struct fs_file *_file, uoff_t length ATTR_UNUSED)
 {
 	struct posix_fs_file *file = (struct posix_fs_file *)_file;
 
@@ -295,10 +295,13 @@
 			return TRUE;
 	}
 
+/* HAVE_POSIX_FADVISE alone isn't enough for CentOS 4.9 */
+#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
 	if (posix_fadvise(file->fd, 0, length, POSIX_FADV_WILLNEED) < 0) {
 		i_error("posix_fadvise(%s) failed: %m", _file->path);
 		return TRUE;
 	}
+#endif
 	return FALSE;
 }
 


More information about the dovecot-cvs mailing list