diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index 1b2d045f7992db701af508bb3959d7540f22451e..6452a697cb98dc0924ea9821b0ee2c5e2aa75aa1 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -687,7 +687,7 @@ void CVSPlugin::startCommit(const QString &source)
     // Create a submit
     m_changeTmpFile->write(submitTemplate.toUtf8());
     m_changeTmpFile->flush();
-    m_changeTmpFile->seek(0);
+    m_changeTmpFile->close();
     // Create a submit editor and set file list
     CVSSubmitEditor *editor = openCVSSubmitEditor(m_changeTmpFile->fileName());
     editor->setStateList(statusOutput);
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 3c3161b47124260628bfa4ae7dfbe6d4173b7d84..304d4a45f313307b67c1f2c95b4ec68bd7c3a958 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -592,10 +592,10 @@ void GitPlugin::startCommit()
     }
     m_changeTmpFile = changeTmpFile;
     m_changeTmpFile->write(commitTemplate.toLocal8Bit());
-    m_changeTmpFile->flush();
+    m_changeTmpFile->flush();    
     // Keep the file alive, else it removes self and forgets
     // its name
-    m_changeTmpFile->seek(0);
+    m_changeTmpFile->close();
     openSubmitEditor(m_changeTmpFile->fileName(), data);
 }
 
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index cd5593ed2b50040f50c92cd3ad7a006af5a5b4b3..e8f7ae3198852a7f8bcb0f53c7ca3b5e089644b2 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -553,6 +553,7 @@ void PerforcePlugin::submit()
     }
 
     m_changeTmpFile = new QTemporaryFile(this);
+    m_changeTmpFile->setAutoRemove(true);
     if (!m_changeTmpFile->open()) {
         VCSBase::VCSBaseOutputWindow::instance()->appendError(tr("Cannot create temporary file."));
         cleanChangeTmpFile();
@@ -567,7 +568,7 @@ void PerforcePlugin::submit()
     }
 
     m_changeTmpFile->write(result.stdOut.toAscii());
-    m_changeTmpFile->seek(0);
+    m_changeTmpFile->close();
 
     // Assemble file list of project
     QString name;
@@ -782,6 +783,15 @@ bool PerforcePlugin::vcsDelete(const QString &fileName)
     return !(result.error && result2.error);
 }
 
+static QString formatCommand(const QString &cmd, const QStringList &args)
+{
+    const QChar blank = QLatin1Char(' ');
+    QString command = cmd;
+    command += blank;
+    command += args.join(QString(blank));
+    return PerforcePlugin::tr("Executing: %1\n").arg(command);
+}
+
 PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
                                           const QStringList &extraArgs,
                                           unsigned logFlags,
@@ -816,13 +826,8 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
     }
     actualArgs << args;
 
-    if (logFlags & CommandToWindow) {
-        QString command = m_settings.p4Command();
-        command += blank;
-        command += actualArgs.join(QString(blank));
-        const QString outputText = tr("Executing: %1\n").arg(command);
-        outputWindow->appendCommand(outputText);
-    }
+    if (logFlags & CommandToWindow)
+        outputWindow->appendCommand(formatCommand(m_settings.p4Command(), actualArgs));
 
     // Run, connect stderr to the output window
     Core::Utils::SynchronousProcess process;
@@ -1025,20 +1030,25 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
         fileIFace->save();
         core->fileManager()->unblockFileChange(fileIFace);
         if (answer == VCSBase::VCSBaseSubmitEditor::SubmitConfirmed) {
-            m_changeTmpFile->seek(0);
+            if (!m_changeTmpFile->open()) {
+                VCSBase::VCSBaseOutputWindow::instance()->appendError(tr("Cannot open temporary file."));
+                return false;
+            }
             QByteArray change = m_changeTmpFile->readAll();
+            m_changeTmpFile->close();
             QString errorMessage;
             if (!checkP4Configuration(&errorMessage)) {
                 VCSBase::VCSBaseOutputWindow::instance()->appendError(errorMessage);
                 return false;
             }
-
             QProcess proc;
             proc.setEnvironment(environment());
 
             QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-            proc.start(m_settings.p4Command(),
-                m_settings.basicP4Args() << QLatin1String("submit") << QLatin1String("-i"));
+            QStringList submitArgs = m_settings.basicP4Args();
+            submitArgs << QLatin1String("submit") << QLatin1String("-i");
+            VCSBase::VCSBaseOutputWindow::instance()->appendCommand(formatCommand(m_settings.p4Command(), submitArgs));
+            proc.start(m_settings.p4Command(),submitArgs);
             if (!proc.waitForStarted(p4Timeout)) {
                 VCSBase::VCSBaseOutputWindow::instance()->appendError(tr("Cannot execute p4 submit."));
                 QApplication::restoreOverrideCursor();
@@ -1052,6 +1062,12 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
                 QApplication::restoreOverrideCursor();
                 return false;
             }
+            const int exitCode = proc.exitCode();
+            if (exitCode) {
+                VCSBase::VCSBaseOutputWindow::instance()->appendError(tr("p4 submit failed (exit code %1).").arg(exitCode));
+                QApplication::restoreOverrideCursor();
+                return false;
+            }
             const QString output = QString::fromLocal8Bit(proc.readAll());
             VCSBase::VCSBaseOutputWindow::instance()->append(output);
             if (output.contains(QLatin1String("Out of date files must be resolved or reverted)"))) {
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index 34b1258e0adb301ddd388412aae4929be44dd30b..718831c9d0961e2e43dd8cc5847bf55ebac3aa56 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -692,7 +692,7 @@ void SubversionPlugin::startCommit(const QStringList &files)
     // Create a submit
     m_changeTmpFile->write(submitTemplate.toUtf8());
     m_changeTmpFile->flush();
-    m_changeTmpFile->seek(0);
+    m_changeTmpFile->close();
     // Create a submit editor and set file list
     SubversionSubmitEditor *editor = openSubversionSubmitEditor(m_changeTmpFile->fileName());
     editor->setStatusList(statusOutput);