summaryrefslogtreecommitdiff
path: root/source4/lib/replace/repdir/config.m4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-25 04:03:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:30:01 -0500
commitf92c000fc903803e1c2817dd407974ec44390593 (patch)
treed807a16484c93d45f463e5c23d1750a1c1ac5a08 /source4/lib/replace/repdir/config.m4
parentfc9ffba41332b5755ede3683208ec989d30fdcd0 (diff)
downloadsamba-f92c000fc903803e1c2817dd407974ec44390593.tar.gz
samba-f92c000fc903803e1c2817dd407974ec44390593.tar.bz2
samba-f92c000fc903803e1c2817dd407974ec44390593.zip
r8746: replace opendir/readdir/telldir/seekdir/closedir on systems where they
are broken (apparently all BSD systems). This breakage leads to unlink on files in an open directory causing a later seekdir to miss files. The bug happens due to a block boundary bug in the BSD libc implementation of these calls. This replacement code also fixes a severe memory usage problem with telldir that can cause closedir() to take an arbitrary amount of time. I have reported the bug in readdir to Greg Lehey (a FreeBSD maintainer) (This used to be commit e1bf7c4279fbc03a52497d24cea375e75059cba1)
Diffstat (limited to 'source4/lib/replace/repdir/config.m4')
-rw-r--r--source4/lib/replace/repdir/config.m417
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/lib/replace/repdir/config.m4 b/source4/lib/replace/repdir/config.m4
new file mode 100644
index 0000000000..0ef40ad8cb
--- /dev/null
+++ b/source4/lib/replace/repdir/config.m4
@@ -0,0 +1,17 @@
+AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
+ AC_TRY_RUN([#include "${srcdir-.}/build/tests/os2_delete.c"],
+ samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=yes)])
+
+if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
+AC_CACHE_CHECK([for replacing readdir],samba_cv_REPLACE_READDIR,[
+ AC_TRY_RUN([
+#include "${srcdir-.}/lib/replace/repdir/repdir.c"
+#include "${srcdir-.}/build/tests/os2_delete.c"],
+ samba_cv_REPLACE_READDIR=yes,samba_cv_REPLACE_READDIR=no)])
+fi
+
+SMB_SUBSYSTEM_ENABLE(REPLACE_READDIR, NO)
+if test x"$samba_cv_REPLACE_READDIR" = x"yes"; then
+ AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
+ SMB_SUBSYSTEM_ENABLE(REPLACE_READDIR, YES)
+fi