Maemo: Fix race condition in SSH output reader.

This commit is contained in:
ck
2010-01-12 17:04:05 +01:00
parent e4024d228c
commit b7abc03ed0
2 changed files with 3 additions and 2 deletions

View File

@@ -132,9 +132,11 @@ void MaemoInteractiveSshConnection::runCommand(const QString &command)
const char * const error = lastError();
if (error)
throw MaemoSshException(tr("SSH error: %1").arg(error));
const char * output = ssh.readAndReset(channel(), alloc);
const char * const output = ssh.readAndReset(channel(), alloc);
if (output) {
emit remoteOutput(QString::fromUtf8(output));
if (!done)
done = strstr(output, m_prompt) != 0;
delete[] output;
}
} while (!done && !stopRequested());