dovecot-1.2: Some versions of Mac OS X have buggy CMSG_* macros,...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Dec 19 10:03:09 EET 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/729576bb91d8
changeset: 8578:729576bb91d8
user: Timo Sirainen <tss at iki.fi>
date: Fri Dec 19 10:02:49 2008 +0200
description:
Some versions of Mac OS X have buggy CMSG_* macros, avoid using them.
Patch by Apple.
diffstat:
1 file changed, 22 insertions(+), 2 deletions(-)
configure.in | 24 ++++++++++++++++++++++--
diffs (57 lines):
diff -r 164569761647 -r 729576bb91d8 configure.in
--- a/configure.in Fri Dec 19 09:46:46 2008 +0200
+++ b/configure.in Fri Dec 19 10:02:49 2008 +0200
@@ -1130,9 +1130,17 @@ AC_CACHE_CHECK([whether fd passing works
#include <fcntl.h>
#include "fdpass.h"
+ int nopen(void)
+ {
+ int i, n;
+ struct stat sb;
+ for (i = n = 0; i < 256; i++)
+ if (fstat(i, &sb) == 0) n++;
+ return n;
+ }
int main(void)
{
- int fd[2], send_fd, recv_fd, status;
+ int fd[2], send_fd, recv_fd, status, n1, n2;
struct stat st, st2;
char data;
@@ -1141,6 +1149,7 @@ AC_CACHE_CHECK([whether fd passing works
unlink("conftest.fdpass");
if (fstat(send_fd, &st) < 0) return 2;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) return 2;
+ n1 = nopen();
switch (fork()) {
case -1:
@@ -1157,7 +1166,10 @@ AC_CACHE_CHECK([whether fd passing works
return status;
if (fd_read(fd[1], &data, 1, &recv_fd) != 1) return 1;
if (fstat(recv_fd, &st2) < 0) return 2;
- return st.st_ino == st2.st_ino ? 0 : 1;
+ /* nopen check is for making sure that only a single fd
+ was received */
+ n2 = nopen();
+ return st.st_ino == st2.st_ino && n2 == n1 + 1 ? 0 : 1;
}
}
], [
@@ -1175,6 +1187,14 @@ AC_CACHE_CHECK([whether fd passing works
])
done
]);
+
+case "$host_os" in
+darwin[[1-9]].*)
+ if test "$i_cv_fd_passing" = "yes"; then
+ i_cv_fd_passing=buggy_cmsg_macros
+ fi
+ ;;
+esac
if test $i_cv_fd_passing = buggy_cmsg_macros; then
AC_DEFINE(BUGGY_CMSG_MACROS,, Define if you have buggy CMSG macros)
More information about the dovecot-cvs
mailing list