sws: close sockets properly

Fix a bug where closed sockets (fd -1) were left in the all_sockets
list, because of missing parens in a pointer arithmetic expression

Reenable the tests that were locking up due to this bug.
This commit is contained in:
Joe Mason 2012-08-06 13:44:38 -04:00 committed by Daniel Stenberg
parent 0df14c8393
commit 42e4c34ff3
2 changed files with 3 additions and 6 deletions

View File

@ -5,6 +5,3 @@
594
1209
1211
2025
2028
2031

View File

@ -2065,9 +2065,9 @@ int main(int argc, char *argv[])
/* Clear out closed sockets */
for (socket_idx = num_sockets - 1; socket_idx >= 1; --socket_idx) {
if (CURL_SOCKET_BAD == all_sockets[socket_idx]) {
char* dst = (char *) all_sockets + socket_idx;
char* src = (char *) all_sockets + socket_idx + 1;
char* end = (char *) all_sockets + num_sockets;
char* dst = (char *) (all_sockets + socket_idx);
char* src = (char *) (all_sockets + socket_idx + 1);
char* end = (char *) (all_sockets + num_sockets);
memmove(dst, src, end - src);
num_sockets -= 1;
}