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>
This commit is contained in:
Joerg Bornemann 2015-09-28 16:27:51 +02:00
parent 9ef8760355
commit 7fe5f82e48

View File

@ -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