summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-09-28 16:27:51 +0200
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-09-29 08:31:54 +0000
commit7fe5f82e48c023edff7c1c60a14f3958ffda8ad2 (patch)
treed0b9fe721bea1f2bb141174e507a62a4eea75db7
parent9ef87603553c59f8666e868a69b75bf240b9cc12 (diff)
clean up QWindowsPipeWriter I/O error handling
Exit early, and add warning messages for (unlikely) error cases. Change-Id: I7130b2e298f3a644a9d0e96a3a1860350e11adff Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index e75712ba80..fd14523d45 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -147,18 +147,19 @@ void QWindowsPipeWriter::run()
DWORD written = 0;
if (!WriteFile(writePipe, ptrData + totalWritten,
maxlen - totalWritten, &written, &overl)) {
-
- if (GetLastError() == 0xE8/*NT_STATUS_INVALID_USER_BUFFER*/) {
+ const DWORD writeError = GetLastError();
+ if (writeError == 0xE8/*NT_STATUS_INVALID_USER_BUFFER*/) {
// give the os a rest
msleep(100);
continue;
}
#ifndef Q_OS_WINCE
- if (GetLastError() == ERROR_IO_PENDING) {
- if (!GetOverlappedResult(writePipe, &overl, &written, TRUE)) {
- return;
- }
- } else {
+ if (writeError != ERROR_IO_PENDING) {
+ qErrnoWarning(writeError, "QWindowsPipeWriter: async WriteFile failed.");
+ return;
+ }
+ if (!GetOverlappedResult(writePipe, &overl, &written, TRUE)) {
+ qErrnoWarning(GetLastError(), "QWindowsPipeWriter: GetOverlappedResult failed.");
return;
}
#else