Process termination & exit code

Alexandre Julliard julliard at winehq.org
Fri Jun 13 18:20:26 CDT 2003


Eric Pouech <pouech-eric at wanadoo.fr> writes:

> as reported by Igor Sysoev on WD, exit process code wasn't properly
> implemented on *BSD
> it appeared (thanks Igor for all the testings and traces) that after
> terminate_process request was issued, the client/server pipe got
> closed because the running thread was actually killed, erasing the
> exit_code that terminate_process had set.
> This patch actually fixes it.

I don't think we need a new thread state just for that; how about
something like this?

Index: server/process.c
===================================================================
RCS file: /home/winehq/opt/cvs-commit/wine/server/process.c,v
retrieving revision 1.104
diff -u -p -r1.104 process.c
--- server/process.c	18 Mar 2003 05:04:33 -0000	1.104
+++ server/process.c	13 Jun 2003 23:18:03 -0000
@@ -688,7 +688,7 @@ void kill_process( struct process *proce
     while (thread)
     {
         struct thread *next = thread->proc_next;
-        thread->exit_code = exit_code;
+        if (exit_code) thread->exit_code = exit_code;
         if (thread != skip) kill_thread( thread, 1 );
         thread = next;
     }
Index: server/request.c
===================================================================
RCS file: /home/winehq/opt/cvs-commit/wine/server/request.c,v
retrieving revision 1.79
diff -u -p -r1.79 request.c
--- server/request.c	28 Mar 2003 00:36:12 -0000	1.79
+++ server/request.c	13 Jun 2003 23:18:04 -0000
@@ -382,7 +382,7 @@ int receive_fd( struct process *process 
         if (ret > 0)
             fprintf( stderr, "Protocol error: process %p: partial recvmsg %d for fd\n",
                      process, ret );
-        kill_process( process, NULL, 1 );
+        kill_process( process, NULL, (ret > 0) );
     }
     else
     {

-- 
Alexandre Julliard
julliard at winehq.com



More information about the wine-devel mailing list