Stefan Dösinger : ntdll: Use the MacOS file handle limit workaround from libs/wine/loader.c.

Alexandre Julliard julliard at winehq.org
Mon Sep 14 14:58:24 CDT 2020


Module: wine
Branch: master
Commit: 4d33a0410e40879ca405a1870cc53ff4da2cc7ba
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4d33a0410e40879ca405a1870cc53ff4da2cc7ba

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Sep 14 15:59:02 2020 +0300

ntdll: Use the MacOS file handle limit workaround from libs/wine/loader.c.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49624
Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/loader.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index bc5b627cbc..82fabc5cde 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -212,7 +212,18 @@ static void set_max_limit( int limit )
     if (!getrlimit( limit, &rlimit ))
     {
         rlimit.rlim_cur = rlimit.rlim_max;
-        setrlimit( limit, &rlimit );
+        if (setrlimit( limit, &rlimit ) != 0)
+        {
+#if defined(__APPLE__) && defined(RLIMIT_NOFILE) && defined(OPEN_MAX)
+            /* On Leopard, setrlimit(RLIMIT_NOFILE, ...) fails on attempts to set
+             * rlim_cur above OPEN_MAX (even if rlim_max > OPEN_MAX). */
+            if (limit == RLIMIT_NOFILE && rlimit.rlim_cur > OPEN_MAX)
+            {
+                rlimit.rlim_cur = OPEN_MAX;
+                setrlimit( limit, &rlimit );
+            }
+#endif
+        }
     }
 }
 




More information about the wine-cvs mailing list