diff options
author | Niels Weber <niels.weber@digia.com> | 2014-03-27 11:12:07 +0100 |
---|---|---|
committer | Niels Weber <niels.weber@digia.com> | 2014-03-27 12:55:25 +0100 |
commit | ddf7aa85ec7bada4a96b2692e4b9f1bdd709cbad (patch) | |
tree | 69b9790e33fc81c544ade514931fdc195aa39362 /src/libs/installer/adminauthorization_x11.cpp | |
parent | 653b34a33962a19864847eaa3c442dd903ee529a (diff) |
Fix hang when entering wrong sudo pw
Task-number: QTIFW-451
Task-number: QTIFW-409
Change-Id: I83ebd338b5f52f2a0b3b1fabcce8fb98afce5e19
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'src/libs/installer/adminauthorization_x11.cpp')
-rw-r--r-- | src/libs/installer/adminauthorization_x11.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libs/installer/adminauthorization_x11.cpp b/src/libs/installer/adminauthorization_x11.cpp index 6d5a52357..9cce8a08b 100644 --- a/src/libs/installer/adminauthorization_x11.cpp +++ b/src/libs/installer/adminauthorization_x11.cpp @@ -177,19 +177,21 @@ bool AdminAuthorization::execute(QWidget *parent, const QString &program, const QRegExp re(QLatin1String("[Pp]assword.*:")); QByteArray errData; flags = ::fcntl(masterFD, F_GETFD); -// if (flags != -1) -// ::fcntl(masterFD, F_SETFL, flags | O_NONBLOCK); int bytes = 0; int errBytes = 0; char buf[1024]; + char errBuf[1024]; while (bytes >= 0) { int state; if (::waitpid(child, &state, WNOHANG) == -1) break; bytes = ::read(masterFD, buf, 1023); - errBytes = ::read(pipedData[0], buf, 1023); + errBytes = ::read(pipedData[0], errBuf, 1023); if (errBytes > 0) + { errData.append(buf, errBytes); + errBytes=0; + } if (bytes > 0) { const QString line = QString::fromLatin1(buf, bytes); if (re.indexIn(line) != -1) { |