Johnny C. Lam wrote:
Richard Valk wrote:
Recently tried to upgrade to the latest version of the courier-auth
daemon on my Mac OS X 10.4 and noticed a (I hope) small problem with the
latest 2 releases.
I compiled using:
./configure --with-authmysql --without-authpam
--with-mysql-libs=/usr/local/mysql/lib/mysql
--with-mysql-includes=/usr/local/mysql/include
As I did always with previous version succesfully, but when trying to
run I got the following error.
richard$ sudo /usr/local/sbin/authdaemond start
/usr/local/var/spool/authdaemon/pid.lock: Bad file descriptor
ll_daemon_start: Resource temporarily unavailable
I reverted to 0.59.3, compiled that with the same settings and
everything works again.
I'm unable to determine what has changed to cause this issue.
Does someone have any ideas ?
OPEN_MAX is the value used in ll_daemon_start() to figure out an
available file descriptor. I've heard that Mac OS X may have some
absurdly high value which may actually be larger than the actual file
descriptor table size. Can you try the attached patch?
I've cleaned up the patch so that it's more appropriate for inclusion
into the Courier sources. It adds a check to configure.in (config.h.in
needs to be regenerated), and patches lockdaemon.c in a more direct way.
Cheers,
-- Johnny C. Lam
--- liblock/configure.in.orig Wed Sep 26 02:44:34 2007
+++ liblock/configure.in
@@ -80,7 +80,7 @@ fi
dnl Checks for library functions.
-AC_CHECK_FUNCS(setpgrp sysconf)
+AC_CHECK_FUNCS(getdtablesize setpgrp sysconf)
AC_CHECK_FUNC(setpgrp,
[
AC_FUNC_SETPGRP
--- liblock/lockdaemon.c.orig Wed Sep 26 02:44:34 2007
+++ liblock/lockdaemon.c
@@ -32,26 +32,4 @@
#endif
-#ifndef OPEN_MAX
-#ifdef HAVE_SYSCONF
-#ifdef _SC_OPEN_MAX
-#define OPEN_MAX (my_open_max())
-
-static int my_open_max()
-{
- long n=sysconf(_SC_OPEN_MAX);
-
- if (n == -1)
- n=64;
- return n;
-}
-
-#endif
-#endif
-#endif
-
-#ifndef OPEN_MAX
-#define OPEN_MAX 64
-#endif
-
#define exit(_a_) _exit(_a_)
@@ -134,5 +112,5 @@ int i;
static int start1(const char *lockfile, int fd)
{
-int lockfd;
+int lockfd, maxfd;
#if HAVE_SETPGRP
@@ -169,5 +147,18 @@ int lockfd;
}
- if (lockfd < 0 || dup2(lockfd, OPEN_MAX-1) != OPEN_MAX-1)
+#if HAVE_GETDTABLESIZE
+ maxfd=getdtablesize()-1;
+#elif defined(OPEN_MAX)
+ maxfd=OPEN_MAX-1;
+#elif HAVE_SYSCONF && defined(_SC_OPEN_MAX)
+ if ((maxfd=sysconf(_SC_OPEN_MAX)) < 0)
+ maxfd=63;
+ else if (maxfd > 0)
+ maxfd--;
+#else
+ maxfd=63;
+#endif
+
+ if (lockfd < 0 || dup2(lockfd, maxfd) != maxfd)
{
perror(lockfile);
@@ -176,5 +167,5 @@ int lockfd;
close(lockfd);
- lockfd=OPEN_MAX-1;
+ lockfd=maxfd;
#ifdef FD_CLOEXEC
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users