]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Joshua Root <josh+squid@root.id.au>
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 15 May 2008 11:43:06 +0000 (23:43 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 15 May 2008 11:43:06 +0000 (23:43 +1200)
Bug 2204: configure fails to detect max open files

The behaviour of setrusage has changed in Mac OS X 10.5.

configure.in

index 09c28b1c7e566587ee96180467f42378a06178ad..c44185d5d77643f61bb1a7844bdebe2c3c9bc9ef 100644 (file)
@@ -3212,7 +3212,12 @@ main() {
     if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
         perror("getrlimit: RLIMIT_NOFILE");
     } else {
+#if defined(__APPLE__)
+        /* asking for more than OPEN_MAX fails on Leopard */
+        rl.rlim_cur = (OPEN_MAX < rl.rlim_max ? OPEN_MAX : rl.rlim_max);
+#else
         rl.rlim_cur = rl.rlim_max;      /* set it to the max */
+#endif
         if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
             perror("setrlimit: RLIMIT_NOFILE");
         }