From 5288267be0e1ebc4b322bae6cc8d0e6bc28be6a7 Mon Sep 17 00:00:00 2001
From: Christian Kandeler <christian.kandeler@nokia.com>
Date: Wed, 7 Sep 2011 15:43:11 +0200
Subject: [PATCH] RemoteLinux: It's not a fatal error when ports gathering
 fails.

Change-Id: If803e1acaaa8164a5177fa5ca227516cc06c577c
Reviewed-on: http://codereview.qt.nokia.com/4364
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
---
 .../remotelinux/remotelinuxapplicationrunner.cpp       | 10 ++++++++--
 .../remotelinux/remotelinuxusedportsgatherer.cpp       |  4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp
index bb8e4350dc7..ab72f824d0b 100644
--- a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp
+++ b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp
@@ -333,8 +333,14 @@ void AbstractRemoteLinuxApplicationRunner::emitError(const QString &errorMsg, bo
 
 void AbstractRemoteLinuxApplicationRunner::handlePortsGathererError(const QString &errorMsg)
 {
-    if (m_d->state != Inactive)
-        emitError(errorMsg);
+    if (m_d->state != Inactive) {
+        if (connection()->errorState() != SshNoError) {
+            emitError(errorMsg);
+        } else {
+            emit reportProgress(tr("Gathering ports failed: %1\nContinuing anyway.").arg(errorMsg));
+            handleUsedPortsAvailable();
+        }
+    }
 }
 
 void AbstractRemoteLinuxApplicationRunner::handleUsedPortsAvailable()
diff --git a/src/plugins/remotelinux/remotelinuxusedportsgatherer.cpp b/src/plugins/remotelinux/remotelinuxusedportsgatherer.cpp
index c824a1542bd..bd790d06b3f 100644
--- a/src/plugins/remotelinux/remotelinuxusedportsgatherer.cpp
+++ b/src/plugins/remotelinux/remotelinuxusedportsgatherer.cpp
@@ -161,8 +161,8 @@ void RemoteLinuxUsedPortsGatherer::handleProcessClosed(int exitStatus)
         if (m_d->procRunner->process()->exitCode() == 0) {
             setupUsedPorts();
         } else {
-            errMsg = tr("Remote process failed: %1")
-                .arg(m_d->procRunner->process()->errorString());
+            errMsg = tr("Remote process failed; exit code was %1.")
+                .arg(m_d->procRunner->process()->exitCode());
         }
         break;
     default:
-- 
GitLab