Hello,

(Not sure whether the postfix-devel list is the right place for such matters; 
please let me know if another place, for example the postfix-users list, would 
be more suitable)

Starting with Mac OS X 10.5, the man page for setrlimit(2) comes with following 
compatibility section:

        setrlimit() now returns with errno set to EINVAL in places that
        historically succeeded.  It no longer accepts "rlim_cur = RLIM_INFINITY"
        for RLIM_NOFILE.  Use "rlim_cur = min(OPEN_MAX, rlim_max)".

As a result, a call such as open_limit(INT_MAX) from src/util/events.c may fail 
and hinder the master process to start.

This is a quick and dirty "fix" tested with Postfix 2.10.0 on Mac OS X 10.8.3:

        --- src/util/open_limit.c.original      1998-12-11 19:55:29.000000000 
+0100
        +++ src/util/open_limit.c       2013-03-21 11:57:05.000000000 +0100
        @@ -63,6 +63,9 @@
             if (getrlimit(RLIMIT_NOFILE, &rl) < 0)
                return (-1);
             if (limit > 0) {
        +#ifdef MACOSX
        +    if (limit > OPEN_MAX) limit = OPEN_MAX;
        +#endif
                if (limit > rl.rlim_max)
                    rl.rlim_cur = rl.rlim_max;
                else

I don't know whether such restrictions on admissible values for rlim_cur are 
liable to occur on other OSes as well. 

Axel

Reply via email to