summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 02:55:54 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 02:55:54 +0000
commiteef1ea503196e51ccf67d69b271c3d715363497d (patch)
treefe490c03f20f1c959e12cf8eeb100fc5a6fcc325
parent8eecfc6f306180fcfd73241cfb59aa1453c49f54 (diff)
downloadchromium_src-eef1ea503196e51ccf67d69b271c3d715363497d.zip
chromium_src-eef1ea503196e51ccf67d69b271c3d715363497d.tar.gz
chromium_src-eef1ea503196e51ccf67d69b271c3d715363497d.tar.bz2
Exit Chromoting host if cannot connect to Mac OS X Window Server
BUG=146673 Review URL: https://chromiumcodereview.appspot.com/10910103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155109 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--remoting/host/remoting_me2me_host.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 1704081..c58e9ad 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -709,6 +709,17 @@ int main(int argc, char** argv) {
logging::APPEND_TO_OLD_LOG_FILE,
logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+#if defined(OS_MACOSX)
+ // Exit permanently if there appears to be no window server running.
+ base::mac::ScopedCFTypeRef<CFDictionaryRef> session(
+ CGSessionCopyCurrentDictionary());
+ if (!session.get()) {
+ // TODO(lambroslambrou): Add a new exit-code to reflect this error.
+ LOG(ERROR) << "Failed to connect to Window Server";
+ return remoting::kInvalidHostConfigurationExitCode;
+ }
+#endif // OS_MACOSX
+
#if defined(TOOLKIT_GTK)
// Required for any calls into GTK functions, such as the Disconnect and
// Continue windows, though these should not be used for the Me2Me case