os: fix FlushClient

Flushclient implicitly cast the result from a write-like call
to size_t, which turned it's error return value, -1,
into a large positive value, breaking the surrounding error-checking code.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111
2025-08-07 13:11:10 +03:00
committed by Enrico Weigelt
parent fe186eee6f
commit 909a5462ac

View File

@@ -916,7 +916,7 @@ FlushClient(ClientPtr who, OsCommPtr oc)
size_t todo = notWritten; /* trying to write that much this time */
while (notWritten) {
errno = 0;
size_t len = _XSERVTransWrite(trans_conn, (const char*)oco->buf + written, todo);
ssize_t len = _XSERVTransWrite(trans_conn, ((const char*)oco->buf) + written, todo);
if (len >= 0) {
written += len;
notWritten -= len;