From 7f99df4688d2a4d0d49a9f331027bb37fcfca234 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Wed, 23 Oct 2024 20:11:19 -0400
Subject: [PATCH] Fixed bug where `return SDL_SetError` no longer returns -1 in
latest SDL3.
---
src/SDL_net.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/SDL_net.c b/src/SDL_net.c
index 3a764cb..1c11f5d 100644
--- a/src/SDL_net.c
+++ b/src/SDL_net.c
@@ -1218,7 +1218,8 @@ int SDLNet_ReadFromStreamSocket(SDLNet_StreamSocket *sock, void *buf, int buflen
const int br = (int) read(sock->handle, buf, buflen);
if (br == 0) {
- return SDL_SetError("End of stream");
+ SDL_SetError("End of stream");
+ return -1;
} else if (br < 0) {
const int err = LastSocketError();
return WouldBlock(err) ? 0 : SetSocketError("Failed to read from socket", err);