[Wine-patches] Prevent creating new wineprefix if we can not run second wineserver (eterbug #4204).

Alexander Morozov amorozov на etersoft.ru
Чт Янв 21 19:22:58 MSK 2010


----------- следующая часть -----------
From fa16219454174fd7d96fa303391c31f057e8e6fc Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Thu, 21 Jan 2010 17:24:22 +0300
Subject: [PATCH] Prevent creating new wineprefix if we can not run second wineserver (eterbug #4204).

---
 etersoft/scripts/wine.in |   11 ++++++++---
 server/main.c            |   14 +++++++++++---
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/etersoft/scripts/wine.in b/etersoft/scripts/wine.in
index 26e9bd6..2fb0a76 100644
--- a/etersoft/scripts/wine.in
+++ b/etersoft/scripts/wine.in
@@ -19,6 +19,7 @@ unset TMPDIR
 WINEADMGRP=wineadmin
 PROGRESS=$WINEPREFIX/winesplash.progress
 WINEDIAG=$BINDIR/winediag
+ETERMSG=$BINDIR/eterx11msg
 WINESERVER=wineserver
 
 # Use /etc/wine/config for set UMASK or ATTACH_MODE
@@ -142,6 +143,13 @@ print_help()
 # update or first run
 update_wine()
 {
+	# Kill all wine processes for any conflicts
+	$WINESERVER -k 2>/dev/null
+	if [ "$?" = "3" ] ; then
+		$ETERMSG -count
+		exit 1
+	fi
+
 	####### WINE dir preparing ########
 	export DEVDIR=${WINEPREFIX}/dosdevices
 	mkdir -p ${WINEPREFIX} ${DEVDIR}/unc
@@ -161,9 +169,6 @@ update_wine()
 	date >>$WINEPREFIX/install.log
 	init_splash
 
-	# Kill all wine processes for any conflicts
-	$WINESERVER -k 2>/dev/null
-
 	if [ "$ATTACH_MODE" = "yes" ] || [ "$ATTACH_MODE" = "1" ] ; then
 		WINEMODE="--attach"
 	fi
diff --git a/server/main.c b/server/main.c
index 972b15e..5062939 100644
--- a/server/main.c
+++ b/server/main.c
@@ -71,6 +71,12 @@ static void check_persist_env(void)
     master_socket_timeout = (timeout_t)atoi( persist ) * -TICKS_PER_SEC;
 }
 
+static void check_terminal_lock(void)
+{
+    LOADETER_FUNC( etersoft_terminal_lock );
+    if (etersoft_terminal_lock && etersoft_terminal_lock()) exit(3);
+}
+
 static void parse_args( int argc, char *argv[] )
 {
     int ret, optc;
@@ -111,6 +117,10 @@ static void parse_args( int argc, char *argv[] )
                     ret = kill_lock_owner( atoi( optarg ) );
                 else
                     ret = kill_lock_owner(-1);
+                /* if we kill nothing then check for the terminal lock
+                   to return other exit code */
+                if (!ret)
+                    check_terminal_lock();
                 exit( !ret );
             case 'p':
                 if (optarg && isdigit(*optarg))
@@ -150,9 +160,7 @@ int main( int argc, char *argv[] )
     signal( SIGTERM, sigterm_handler );
     signal( SIGABRT, sigterm_handler );
 
-    LOADETER_FUNC( etersoft_terminal_lock );
-    if (etersoft_terminal_lock && etersoft_terminal_lock()) return 3;
-
+    check_terminal_lock();
     sock_init();
     open_master_socket();
 
-- 
1.6.5.7



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