Module: wine Branch: master Commit: 67bc4a6d765941d830477f749ab7b0697f1488b2 URL: https://source.winehq.org/git/wine.git/?a=commit;h=67bc4a6d765941d830477f749...
Author: Alexandre Julliard julliard@winehq.org Date: Tue May 19 14:08:30 2020 +0200
ntdll: Don't use libwine during the Unix library initialization.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/unix/loader.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 427eeaf413..9028b2de81 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -156,6 +156,17 @@ static void fatal_error( const char *err, ... ) exit(1); }
+static void set_max_limit( int limit ) +{ + struct rlimit rlimit; + + if (!getrlimit( limit, &rlimit )) + { + rlimit.rlim_cur = rlimit.rlim_max; + setrlimit( limit, &rlimit ); + } +} + /* canonicalize path and return its directory name */ static char *realpath_dirname( const char *name ) { @@ -905,23 +916,11 @@ static void check_vmsplit( void *stack ) } }
-static void set_max_limit( int limit ) -{ - struct rlimit rlimit; - - if (!getrlimit( limit, &rlimit )) - { - rlimit.rlim_cur = rlimit.rlim_max; - setrlimit( limit, &rlimit ); - } -} - static int pre_exec(void) { int temp;
check_vmsplit( &temp ); - set_max_limit( RLIMIT_AS ); #ifdef __i386__ return 1; /* we have a preloader on x86 */ #else @@ -1004,7 +1003,6 @@ void __wine_main( int argc, char *argv[], char *envp[] ) { HMODULE module;
- wine_init_argv0_path( argv[0] ); init_paths( argc, argv, envp );
if (!getenv( "WINELOADERNOEXEC" )) /* first time around */ @@ -1015,11 +1013,20 @@ void __wine_main( int argc, char *argv[], char *envp[] ) check_command_line( argc, argv ); if (pre_exec()) { - wine_exec_wine_binary( NULL, argv, getenv( "WINELOADER" )); + char **new_argv = malloc( (argc + 2) * sizeof(*argv) ); + memcpy( new_argv + 1, argv, (argc + 1) * sizeof(*argv) ); + loader_exec( argv0, new_argv, is_win64 ); fatal_error( "could not exec the wine loader\n" ); } }
+#ifdef RLIMIT_NOFILE + set_max_limit( RLIMIT_NOFILE ); +#endif +#ifdef RLIMIT_AS + set_max_limit( RLIMIT_AS ); +#endif + virtual_init();
module = load_ntdll();