summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qwindowspipereader.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2012-11-01 12:14:09 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-02 12:16:49 +0100
commitc6f3d919dd82497183bdf780b0d00aeb374aa934 (patch)
tree760cb6183daa0f81a9c80af12b5dd218d1873c66 /src/corelib/io/qwindowspipereader.cpp
parent44e0d2b3287d3b4e5e9589f887e7d436402d02b4 (diff)
fix error handling bug in QWindowsPipeReader
If ReadFile returns with an error then we must set our internal state accordingly. QWindowsPipeReader::readSequenceStarted must be set to false. If ReadFile fails, we're not within a read sequence. Also, we must handle the ERROR_BROKEN_PIPE error. Task-number: QTBUG-25342 Change-Id: Ic9247f170fa9cc47fa7e45d0f47ccfedac06a593 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'src/corelib/io/qwindowspipereader.cpp')
-rw-r--r--src/corelib/io/qwindowspipereader.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index cca6e80810..bef6097043 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -213,7 +213,8 @@ void QWindowsPipeReader::startAsyncRead()
// We get notified by the QWinOverlappedIoNotifier - even in the synchronous case.
return;
} else {
- switch (GetLastError()) {
+ const DWORD dwError = GetLastError();
+ switch (dwError) {
case ERROR_IO_PENDING:
// This is not an error. We're getting notified, when data arrives.
return;
@@ -223,16 +224,19 @@ void QWindowsPipeReader::startAsyncRead()
// didn't fit into the pipe's system buffer.
// We're getting notified by the QWinOverlappedIoNotifier.
break;
+ case ERROR_BROKEN_PIPE:
case ERROR_PIPE_NOT_CONNECTED:
{
// It may happen, that the other side closes the connection directly
// after writing data. Then we must set the appropriate socket state.
+ readSequenceStarted = false;
pipeBroken = true;
emit pipeClosed();
return;
}
default:
- emit winError(GetLastError(), QLatin1String("QWindowsPipeReader::startAsyncRead"));
+ readSequenceStarted = false;
+ emit winError(dwError, QLatin1String("QWindowsPipeReader::startAsyncRead"));
return;
}
}