[Wine-patches] [eterhack] Modify a check for second wineserver running (eterbug #4395).

Alexander Morozov amorozov на etersoft.ru
Ср Окт 28 17:51:13 MSK 2009


----------- следующая часть -----------
From f6d8dccfe349c493cdb0d6c5b0020cc33f237ccb Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Wed, 28 Oct 2009 17:48:03 +0300
Subject: [eterhack] Modify a check for second wineserver running (eterbug #4395).

---
 dlls/ntdll/server.c |   13 ++++++++++++-
 server/main.c       |    6 +-----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 1c41a36..f72f78c 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -123,6 +123,7 @@ timeout_t server_start_time = 0;  /* time of server startup */
 
 sigset_t server_block_set;  /* signals to block during server calls */
 static int fd_socket = -1;  /* socket to exchange file descriptors with the server */
+static int terminal_lock;
 
 static RTL_CRITICAL_SECTION fd_cache_section;
 static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
@@ -729,7 +730,11 @@ static void start_server(void)
         }
         waitpid( pid, &status, 0 );
         status = WIFEXITED(status) ? WEXITSTATUS(status) : 1;
-        if (status == 3) fatal_error( "can not start second wineserver\n" );
+        if (status == 3)
+        {
+            terminal_lock = 1;
+            return;
+        }
         if (status == 2) return;  /* server lock held by someone else, will retry later */
         if (status) exit(status);  /* server failed */
         started = 1;
@@ -794,6 +799,12 @@ static void server_connect_error( const char *serverdir )
     int fd;
     struct flock fl;
 
+    if (terminal_lock)
+    {
+        system("eterx11msg -count");
+        exit(1);
+    }
+
     if ((fd = open( LOCKNAME, O_WRONLY )) == -1)
         fatal_error( "for some mysterious reason, the wine server never started.\n" );
 
diff --git a/server/main.c b/server/main.c
index ef69211..972b15e 100644
--- a/server/main.c
+++ b/server/main.c
@@ -151,11 +151,7 @@ int main( int argc, char *argv[] )
     signal( SIGABRT, sigterm_handler );
 
     LOADETER_FUNC( etersoft_terminal_lock );
-    if (etersoft_terminal_lock && etersoft_terminal_lock())
-    {
-        system("eterx11msg -count");
-        return 3;
-    }
+    if (etersoft_terminal_lock && etersoft_terminal_lock()) return 3;
 
     sock_init();
     open_master_socket();
-- 
1.6.4.4



Подробная информация о списке рассылки Wine-patches