--- src/server.c.orig 2015-03-31 03:56:28.000000000 -0700 +++ src/server.c 2015-05-05 02:17:22.000000000 -0700 @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include @@ -93,7 +95,7 @@ if (pthread_atfork (NULL, NULL, atfork_child_restore_rlimit_nofile) != 0) return FALSE; - l.rlim_cur = l.rlim_max = sv_rlimit_nofile.rlim_max; + l.rlim_cur = l.rlim_max = MIN(OPEN_MAX, sv_rlimit_nofile.rlim_max); if (setrlimit (RLIMIT_NOFILE, &l) < 0) return FALSE; @@ -167,7 +169,7 @@ } if (!increase_rlimit_nofile ()) { - g_printerr ("Failed to increase RLIMIT_NOFILE: %m\n"); + g_printerr ("Failed to increase RLIMIT_NOFILE: %s\n", strerror(errno)); } /* Now we can create the app */