diff options
author | Björn Jacke <bj@sernet.de> | 2009-12-04 23:26:47 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2009-12-08 10:58:33 +0100 |
commit | 540008bb372b3f69b98ea8bbbc19bd881dc214c3 (patch) | |
tree | 61de8cb408fe1abb85bc2190b1f2ea2535670d8b | |
parent | 68c70feee89e8100e12f89010eeed7189045eee6 (diff) | |
download | samba-540008bb372b3f69b98ea8bbbc19bd881dc214c3.tar.gz samba-540008bb372b3f69b98ea8bbbc19bd881dc214c3.tar.xz samba-540008bb372b3f69b98ea8bbbc19bd881dc214c3.zip |
s3: check if glibc has broken posix_fallocate
(cherry picked from commit 5062e190ed27e16145d9275533b6dd5bcb10209e)
-rw-r--r-- | source3/configure.in | 16 | ||||
-rw-r--r-- | source3/lib/system.c | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/source3/configure.in b/source3/configure.in index 1517bc51ffb..20293eab131 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -2917,6 +2917,22 @@ exit(1); fi fi +# glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT. +AC_CACHE_CHECK([for broken posix_fallocate],samba_cv_HAVE_BROKEN_POSIX_FALLOCATE,[ +AC_TRY_COMPILE([ + #define _XOPEN_SOURCE 600 + #include <stdlib.h> + #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4)) + probably broken posix_fallocate + #endif +], [ +], +samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=no,samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=yes)]) +if test x"$samba_cv_HAVE_BROKEN_POSIX_FALLOCATE" = xyes; then + AC_DEFINE(HAVE_BROKEN_POSIX_FALLOCATE,, Whether we have a broken posix_fallocate) +fi + + AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[ AC_TRY_COMPILE([#include <sys/types.h> #include <sys/stat.h> diff --git a/source3/lib/system.c b/source3/lib/system.c index f076d5a1566..a2dd89982e2 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -621,7 +621,7 @@ int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf, /******************************************************************* An posix_fallocate() wrapper that will deal with 64 bit filesizes. ********************************************************************/ -#if defined(HAVE_POSIX_FALLOCATE64) || defined(HAVE_POSIX_FALLOCATE) +#if (defined(HAVE_POSIX_FALLOCATE64) || defined(HAVE_POSIX_FALLOCATE)) && !defined(HAVE_BROKEN_POSIX_FALLOCATE) int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len) { #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_POSIX_FALLOCATE64) |