Commit 1d2d0d56 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Send the version with the initial fd so that it can be checked before…

server: Send the version with the initial fd so that it can be checked before sending the first request.
parent eb4eda27
...@@ -934,7 +934,7 @@ static void send_server_task_port(void) ...@@ -934,7 +934,7 @@ static void send_server_task_port(void)
*/ */
void server_init_process(void) void server_init_process(void)
{ {
obj_handle_t dummy_handle; obj_handle_t version;
const char *env_socket = getenv( "WINESERVERSOCKET" ); const char *env_socket = getenv( "WINESERVERSOCKET" );
if (env_socket) if (env_socket)
...@@ -958,8 +958,15 @@ void server_init_process(void) ...@@ -958,8 +958,15 @@ void server_init_process(void)
pthread_functions.sigprocmask( SIG_BLOCK, &server_block_set, NULL ); pthread_functions.sigprocmask( SIG_BLOCK, &server_block_set, NULL );
/* receive the first thread request fd on the main socket */ /* receive the first thread request fd on the main socket */
ntdll_get_thread_data()->request_fd = receive_fd( &dummy_handle ); ntdll_get_thread_data()->request_fd = receive_fd( &version );
if (version != SERVER_PROTOCOL_VERSION)
server_protocol_error( "version mismatch %d/%d.\n"
"Your %s binary was not upgraded correctly,\n"
"or you have an older one somewhere in your PATH.\n"
"Or maybe the wrong wineserver is still running?\n",
version, SERVER_PROTOCOL_VERSION,
(version > SERVER_PROTOCOL_VERSION) ? "wine" : "wineserver" );
#ifdef __APPLE__ #ifdef __APPLE__
send_server_task_port(); send_server_task_port();
#endif #endif
...@@ -1004,7 +1011,7 @@ NTSTATUS server_init_process_done(void) ...@@ -1004,7 +1011,7 @@ NTSTATUS server_init_process_done(void)
*/ */
size_t server_init_thread( int unix_pid, int unix_tid, void *entry_point ) size_t server_init_thread( int unix_pid, int unix_tid, void *entry_point )
{ {
int version, ret; int ret;
int reply_pipe[2]; int reply_pipe[2];
struct sigaction sig_act; struct sigaction sig_act;
size_t info_size; size_t info_size;
...@@ -1049,18 +1056,10 @@ size_t server_init_thread( int unix_pid, int unix_tid, void *entry_point ) ...@@ -1049,18 +1056,10 @@ size_t server_init_thread( int unix_pid, int unix_tid, void *entry_point )
NtCurrentTeb()->ClientId.UniqueProcess = ULongToHandle(reply->pid); NtCurrentTeb()->ClientId.UniqueProcess = ULongToHandle(reply->pid);
NtCurrentTeb()->ClientId.UniqueThread = ULongToHandle(reply->tid); NtCurrentTeb()->ClientId.UniqueThread = ULongToHandle(reply->tid);
info_size = reply->info_size; info_size = reply->info_size;
version = reply->version;
server_start_time = reply->server_start; server_start_time = reply->server_start;
} }
SERVER_END_REQ; SERVER_END_REQ;
if (ret) server_protocol_error( "init_thread failed with status %x\n", ret ); if (ret) server_protocol_error( "init_thread failed with status %x\n", ret );
if (version != SERVER_PROTOCOL_VERSION)
server_protocol_error( "version mismatch %d/%d.\n"
"Your %s binary was not upgraded correctly,\n"
"or you have an older one somewhere in your PATH.\n"
"Or maybe the wrong wineserver is still running?\n",
version, SERVER_PROTOCOL_VERSION,
(version > SERVER_PROTOCOL_VERSION) ? "wine" : "wineserver" );
return info_size; return info_size;
} }
...@@ -377,7 +377,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit ...@@ -377,7 +377,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
file_set_error(); file_set_error();
goto error; goto error;
} }
if (send_client_fd( process, request_pipe[1], 0 ) == -1) if (send_client_fd( process, request_pipe[1], SERVER_PROTOCOL_VERSION ) == -1)
{ {
close( request_pipe[0] ); close( request_pipe[0] );
close( request_pipe[1] ); close( request_pipe[1] );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment