ntdll: Close server socket before calling exit().

So if a native exit handler hangs the process eventually gets killed by server.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2021-03-30 20:32:15 +03:00 committed by Alexandre Julliard
parent 672df33f7d
commit 51f7c9d15e
3 changed files with 14 additions and 1 deletions

View File

@ -1470,6 +1470,18 @@ static void init_teb64( TEB *teb )
#endif
}
/***********************************************************************
* process_exit_wrapper
*
* Close server socket and exit process normally.
*/
void process_exit_wrapper( int status )
{
close( fd_socket );
exit( status );
}
/***********************************************************************
* server_init_process
*

View File

@ -329,7 +329,7 @@ static void exit_thread( int status )
void exit_process( int status )
{
pthread_sigmask( SIG_BLOCK, &server_block_set, NULL );
signal_exit_thread( get_unix_exit_code( status ), exit );
signal_exit_thread( get_unix_exit_code( status ), process_exit_wrapper );
}

View File

@ -164,6 +164,7 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *
apc_result_t *result ) DECLSPEC_HIDDEN;
extern int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd,
int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN;
extern void process_exit_wrapper( int status ) DECLSPEC_HIDDEN;
extern size_t server_init_process(void) DECLSPEC_HIDDEN;
extern void server_init_process_done(void) DECLSPEC_HIDDEN;
extern void server_init_thread( void *entry_point, BOOL *suspend ) DECLSPEC_HIDDEN;