Handle EWOULDBLOCK the same way as EAGAIN when writing to sockets on Unix

On most platforms EWOULDBLOCK is defined to be equal to EAGAIN.
However on some platforms (like VxWorks) it is not the case.
Because of that, error returned from ::write is not handled properly on
such platform.
Since C++ does not allow duplicate switch labels, check if EWOULDBLOCK
and EAGAIN have different values before adding EWOULDBLOCK to the switch
statement.

Task-number: QTBUG-115777
Pick-to: 6.7
Change-Id: I659cb946f239733f5c57b2000fb4e3d296ed9153
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Łukasz Matysiak 2024-01-25 15:48:11 +01:00
parent fde57300ab
commit 1d46bb3c92

View File

@ -1275,6 +1275,9 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len)
setError(QAbstractSocket::RemoteHostClosedError, RemoteHostClosedErrorString);
q->close();
break;
#if EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
case EAGAIN:
writtenBytes = 0;
break;