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:
parent
9ef8760355
commit
7fe5f82e48
@ -147,18 +147,19 @@ void QWindowsPipeWriter::run()
|
|||||||
DWORD written = 0;
|
DWORD written = 0;
|
||||||
if (!WriteFile(writePipe, ptrData + totalWritten,
|
if (!WriteFile(writePipe, ptrData + totalWritten,
|
||||||
maxlen - totalWritten, &written, &overl)) {
|
maxlen - totalWritten, &written, &overl)) {
|
||||||
|
const DWORD writeError = GetLastError();
|
||||||
if (GetLastError() == 0xE8/*NT_STATUS_INVALID_USER_BUFFER*/) {
|
if (writeError == 0xE8/*NT_STATUS_INVALID_USER_BUFFER*/) {
|
||||||
// give the os a rest
|
// give the os a rest
|
||||||
msleep(100);
|
msleep(100);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifndef Q_OS_WINCE
|
#ifndef Q_OS_WINCE
|
||||||
if (GetLastError() == ERROR_IO_PENDING) {
|
if (writeError != ERROR_IO_PENDING) {
|
||||||
if (!GetOverlappedResult(writePipe, &overl, &written, TRUE)) {
|
qErrnoWarning(writeError, "QWindowsPipeWriter: async WriteFile failed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
if (!GetOverlappedResult(writePipe, &overl, &written, TRUE)) {
|
||||||
|
qErrnoWarning(GetLastError(), "QWindowsPipeWriter: GetOverlappedResult failed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user