]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
vmware-user: Eliminate racy exit situation.
authorVMware, Inc <>
Mon, 26 Apr 2010 18:15:18 +0000 (11:15 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Tue, 27 Apr 2010 03:48:52 +0000 (20:48 -0700)
Vmware-user's signal handler was destroying RPC channels when it
shouldn't have.  Rather than having a few cases where we decide to
call VMwareUserCleanupRpc before exiting the main loop, this change
simply places a call to VMwareUserCleanupRpc /after/ the main loop
has exited.  (The X I/O error handler is a special case, as apps
are -not- supposed to return from that handler.)

In the case of bug 542135, vmware-user received SIGUSR2 while still
initializing, destroying gRpcIn, before control was returned to the
initialization and eventmanager routines which expected gRpcIn to
still exist.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/vmware-user/vmware-user.cpp

index 28ac5c25e9c01dbab3c116d7fc4cd7fe392757e4..5b7a4177ed8d053a0e4f27b8ed590e90fc1d03fb 100644 (file)
@@ -254,10 +254,6 @@ void VMwareUserSignalHandler(int sig) // IN
       gSigExit = TRUE;
    }
 
-   if (gSigExit) {
-      VMwareUserCleanupRpc(FALSE);
-   }
-
 #if defined(HAVE_GTKMM)
    Gtk::Main::quit();
 #else
@@ -287,7 +283,6 @@ void
 VMwareUser_OnDestroy(GtkWidget *widget, // IN: Unused
                      gpointer data)     // IN: Unused
 {
-   VMwareUserCleanupRpc(FALSE);
 #if defined(HAVE_GTKMM)
    Gtk::Main::quit();
 #else
@@ -1069,6 +1064,11 @@ main(int argc,         // IN
    }
 #endif
 
+   /*
+    * Clean up everything attached to the backdoor before waving goodbye.
+    */
+   VMwareUserCleanupRpc(FALSE);
+
    /*
     * SIGUSR2 sets this to TRUE, indicating that we should relaunch ourselves.
     * This is useful during a Tools upgrade where we'd like to automatically