mirror of https://github.com/xbmc/xbmc
Replace incorrect check of `result` with a direct validation of `sockets[1]` against `INVALID_SOCKET` after the `accept` call.
This ensures the error condition is explicitly tied to the validity of the accepted socket,.
This commit is contained in:
parent
02ed1f8ef4
commit
46e31c8261
|
|
@ -601,7 +601,7 @@ socketpair(int, int, int, SOCKET sockets[2]) // we ignore the first two params:
|
|||
// accept the connection, resulting in the second socket
|
||||
name_length = sizeof(inet_address);
|
||||
sockets[1] = accept(listener, (sockaddr*)&inet_address, &name_length);
|
||||
if (result != 0) goto fail;
|
||||
if (sockets[1] == INVALID_SOCKET) goto fail;
|
||||
|
||||
// we don't need the listener anymore
|
||||
closesocket(listener);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/lib/libUPnP/Neptune/Source/System/Bsd/NptBsdSockets.cpp b/lib/libUPnP/Neptune/Source/System/Bsd/NptBsdSockets.cpp
|
||||
index 063be46a7d..5fe276fb26 100644
|
||||
--- a/lib/libUPnP/Neptune/Source/System/Bsd/NptBsdSockets.cpp
|
||||
+++ b/lib/libUPnP/Neptune/Source/System/Bsd/NptBsdSockets.cpp
|
||||
@@ -601,7 +601,7 @@ socketpair(int, int, int, SOCKET sockets[2]) // we ignore the first two params:
|
||||
// accept the connection, resulting in the second socket
|
||||
name_length = sizeof(inet_address);
|
||||
sockets[1] = accept(listener, (sockaddr*)&inet_address, &name_length);
|
||||
- if (result != 0) goto fail;
|
||||
+ if (sockets[1] == INVALID_SOCKET) goto fail;
|
||||
|
||||
// we don't need the listener anymore
|
||||
closesocket(listener);
|
||||
Loading…
Reference in New Issue