Alexandre Julliard : ntdll: Update argc when changing process name.

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


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Sep 14 15:30:48 2020 +0200

ntdll: Update argc when changing process name.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49834
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/env.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index e1a3d33957..350fe6e8e0 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -736,7 +736,7 @@ char **build_envp( const WCHAR *envW )
  *
  * Change the process name in the ps output.
  */
-static void set_process_name( int argc, char *argv[] )
+static int set_process_name( int argc, char *argv[] )
 {
     BOOL shift_strings;
     char *p, *name;
@@ -790,6 +790,7 @@ static void set_process_name( int argc, char *argv[] )
 #endif
     prctl( PR_SET_NAME, name );
 #endif  /* HAVE_PRCTL */
+    return argc - 1;
 }
 
 
@@ -954,14 +955,14 @@ void init_environment( int argc, char *argv[], char *envp[] )
 
     init_unix_codepage();
     init_locale();
-    set_process_name( argc, argv );
 
     if ((case_table = read_nls_file( "l_intl" )))
     {
         uctable = case_table + 2;
         lctable = case_table + case_table[1] + 2;
     }
-    main_argc = argc;
+
+    main_argc = set_process_name( argc, argv );
     main_argv = argv;
     main_wargv = build_wargv( argv );
     main_envp = envp;




More information about the wine-cvs mailing list