From: VMware, Inc <> Date: Mon, 26 Apr 2010 18:15:18 +0000 (-0700) Subject: vmware-user: Eliminate racy exit situation. X-Git-Tag: 2010.04.25-253928~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=033c5dd896ca92e901c1eb490aa6c8663d2b8ea9;p=thirdparty%2Fopen-vm-tools.git vmware-user: Eliminate racy exit situation. 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 --- diff --git a/open-vm-tools/vmware-user/vmware-user.cpp b/open-vm-tools/vmware-user/vmware-user.cpp index 28ac5c25e..5b7a4177e 100644 --- a/open-vm-tools/vmware-user/vmware-user.cpp +++ b/open-vm-tools/vmware-user/vmware-user.cpp @@ -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