Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 29956)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 29957)
@@ -7407,7 +7407,13 @@
                 {
                     /* -> ConsoleImplTeleporter.cpp */
-                    vrc = console->teleporterTrg(pVM, pMachine, task->mStartPaused, task->mProgress);
-                    if (RT_FAILURE(vrc) && !task->mErrorMsg.length())
-                        rc = E_FAIL;    /* Avoid the "Missing error message..." assertion. */
+                    bool fPowerOffOnFailure;
+                    rc = console->teleporterTrg(pVM, pMachine, &task->mErrorMsg, task->mStartPaused,
+                                                task->mProgress, &fPowerOffOnFailure);
+                    if (FAILED(rc) && fPowerOffOnFailure)
+                    {
+                        ErrorInfoKeeper eik;
+                        int vrc2 = VMR3PowerOff(pVM);
+                        AssertRC(vrc2);
+                    }
                 }
                 else if (task->mStartPaused)
Index: /trunk/src/VBox/Main/ConsoleImplTeleporter.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImplTeleporter.cpp	(revision 29956)
+++ /trunk/src/VBox/Main/ConsoleImplTeleporter.cpp	(revision 29957)
@@ -664,4 +664,5 @@
         return hrc;
 
+    RTSocketRetain(pState->mhSocket);
     void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(pState));
     vrc = VMR3Teleport(pState->mpVM, pState->mcMsMaxDowntime,
@@ -669,4 +670,5 @@
                        teleporterProgressCallback, pvUser,
                        &pState->mfSuspendedByUs);
+    RTSocketRelease(pState->mhSocket);
     if (RT_FAILURE(vrc))
         return setError(E_FAIL, tr("VMR3Teleport -> %Rrc"), vrc);
@@ -979,15 +981,21 @@
  * @param   pVM                 The VM handle
  * @param   pMachine            The IMachine for the virtual machine.
+ * @param   pErrorMsg           Pointer to the error string for VMSetError.
  * @param   fStartPaused        Whether to start it in the Paused (true) or
  *                              Running (false) state,
  * @param   pProgress           Pointer to the progress object.
+ * @param   pfPowerOffOnFailure Whether the caller should power off
+ *                              the VM on failure.
  *
  * @remarks The caller expects error information to be set on failure.
  * @todo    Check that all the possible failure paths sets error info...
  */
-int
-Console::teleporterTrg(PVM pVM, IMachine *pMachine, bool fStartPaused, Progress *pProgress)
+HRESULT
+Console::teleporterTrg(PVM pVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
+                       Progress *pProgress, bool *pfPowerOffOnFailure)
 {
     LogThisFunc(("pVM=%p pMachine=%p fStartPaused=%RTbool pProgress=%p\n", pVM, pMachine, fStartPaused, pProgress));
+
+    *pfPowerOffOnFailure = true;
 
     /*
@@ -997,5 +1005,5 @@
     HRESULT hrc = pMachine->COMGETTER(TeleporterPort)(&uPort);
     if (FAILED(hrc))
-        return VERR_GENERAL_FAILURE;
+        return hrc;
     ULONG const uPortOrg = uPort;
 
@@ -1003,5 +1011,5 @@
     hrc = pMachine->COMGETTER(TeleporterAddress)(bstrAddress.asOutParam());
     if (FAILED(hrc))
-        return VERR_GENERAL_FAILURE;
+        return hrc;
     Utf8Str strAddress(bstrAddress);
     const char *pszAddress = strAddress.isEmpty() ? NULL : strAddress.c_str();
@@ -1010,5 +1018,5 @@
     hrc = pMachine->COMGETTER(TeleporterPassword)(bstrPassword.asOutParam());
     if (FAILED(hrc))
-        return VERR_GENERAL_FAILURE;
+        return hrc;
     Utf8Str strPassword(bstrPassword);
     strPassword.append('\n');           /* To simplify password checking. */
@@ -1036,10 +1044,10 @@
             {
                 RTTcpServerDestroy(hServer);
-                return VERR_GENERAL_FAILURE;
+                return hrc;
             }
         }
     }
     if (RT_FAILURE(vrc))
-        return vrc;
+        return setError(E_FAIL, tr("RTTcpServerCreateEx failed with status %Rrc"), vrc);
 
     /*
@@ -1060,5 +1068,4 @@
             theState.mhServer          = hServer;
 
-            bool fPowerOff = true;
             void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(&theState));
             if (pProgress->setCancelCallback(teleporterProgressCancelCallback, pvUser))
@@ -1076,11 +1083,19 @@
                         /* Power off the VM on failure unless the state callback
                            already did that. */
-                        fPowerOff = false;
-                        if (RT_FAILURE(vrc))
+                        *pfPowerOffOnFailure = false;
+                        if (RT_SUCCESS(vrc))
+                            hrc = S_OK;
+                        else
                         {
                             VMSTATE enmVMState = VMR3GetState(pVM);
                             if (    enmVMState != VMSTATE_OFF
                                 &&  enmVMState != VMSTATE_POWERING_OFF)
-                                fPowerOff = true;
+                                *pfPowerOffOnFailure = true;
+
+                            /* Set error. */
+                            if (pErrorMsg->length())
+                                hrc = setError(E_FAIL, "%s", pErrorMsg->c_str());
+                            else
+                                hrc = setError(E_FAIL, tr("Teleporation failed (%Rrc)"), vrc);
                         }
                     }
@@ -1090,42 +1105,31 @@
                         hrc = pProgress->COMGETTER(Canceled)(&fCancelled);
                         if (FAILED(hrc) || fCancelled)
-                        {
-                            setError(E_FAIL, tr("Teleporting canceled"));
-                            vrc = VERR_SSM_CANCELLED;
-                        }
+                            hrc = setError(E_FAIL, tr("Teleporting canceled"));
                         else
-                        {
-                            setError(E_FAIL, tr("Teleporter timed out waiting for incoming connection"));
-                            vrc = VERR_TIMEOUT;
-                        }
+                            hrc = setError(E_FAIL, tr("Teleporter timed out waiting for incoming connection"));
                         LogRel(("Teleporter: RTTcpServerListen aborted - %Rrc\n", vrc));
                     }
                     else
                     {
+                        hrc = setError(E_FAIL, tr("Unexpected RTTcpServerListen status code %Rrc"), vrc);
                         LogRel(("Teleporter: Unexpected RTTcpServerListen rc: %Rrc\n", vrc));
-                        vrc = VERR_IPE_UNEXPECTED_STATUS;
                     }
                 }
                 else
-                {
                     LogThisFunc(("SetNextOperation failed, %Rhrc\n", hrc));
-                    vrc = Global::vboxStatusCodeFromCOM(hrc);
-                }
             }
             else
             {
                 LogThisFunc(("Canceled - check point #1\n"));
-                vrc = VERR_SSM_CANCELLED;
-            }
-
-            if (fPowerOff)
-            {
-                int vrc2 = VMR3PowerOff(pVM);
-                AssertRC(vrc2);
-            }
-        }
+                hrc = setError(E_FAIL, tr("Teleporting canceled"));
+            }
+        }
+        else
+            hrc = setError(E_FAIL, "RTTimerLRStart -> %Rrc", vrc);
 
         RTTimerLRDestroy(hTimerLR);
     }
+    else
+        hrc = setError(E_FAIL, "RTTimerLRCreate -> %Rrc", vrc);
     RTTcpServerDestroy(hServer);
 
@@ -1135,7 +1139,10 @@
      */
     if (uPortOrg != uPort)
+    {
+        ErrorInfoKeeper Eik;
         pMachine->COMSETTER(TeleporterPort)(uPortOrg);
-
-    return vrc;
+    }
+
+    return hrc;
 }
 
Index: /trunk/src/VBox/Main/include/ConsoleImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 29956)
+++ /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 29957)
@@ -573,5 +573,6 @@
     HRESULT                     teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
     HRESULT                     teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
-    int                         teleporterTrg(PVM pVM, IMachine *pMachine, bool fStartPaused, Progress *pProgress);
+    HRESULT                     teleporterTrg(PVM pVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
+                                              Progress *pProgress, bool *pfPowerOffOnFailure);
     static DECLCALLBACK(int)    teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
     /** @} */
