From 340131b4be282063d5dbe352a58e4b2c45994f77 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Tue, 31 Aug 2021 19:44:53 +0300 Subject: [PATCH] QWindowsPipeWriter: suppress a warning on unexpected peer disconnection The other side can close the pipe at any time independently of us, so ignore the ERROR_PIPE_NOT_CONNECTED error code if the write operation failed. Change-Id: I4f7ccd73c19ca2dd24fa1c9f33b5f60541a7521d Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qwindowspipewriter.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp index 2db3cb4060..e1213e5185 100644 --- a/src/corelib/io/qwindowspipewriter.cpp +++ b/src/corelib/io/qwindowspipewriter.cpp @@ -262,9 +262,15 @@ bool QWindowsPipeWriter::writeCompleted(DWORD errorCode, DWORD numberOfBytesWrit lastError = errorCode; writeBuffer.clear(); - // The other end has closed the pipe. This can happen in QLocalSocket. Do not warn. - if (errorCode != ERROR_OPERATION_ABORTED && errorCode != ERROR_NO_DATA) + switch (errorCode) { + case ERROR_PIPE_NOT_CONNECTED: // the other end has closed the pipe + case ERROR_OPERATION_ABORTED: // the operation was canceled + case ERROR_NO_DATA: // the pipe is being closed + break; + default: qErrnoWarning(errorCode, "QWindowsPipeWriter: write failed."); + break; + } return false; }