Commit 42e4c34f authored by Joe Mason's avatar Joe Mason Committed by Daniel Stenberg
Browse files

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.
parent 0df14c83
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -5,6 +5,3 @@
594
1209
1211
2025
2028
2031
+3 −3
Original line number Diff line number Diff line
@@ -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;
      }