aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Mason <jmason@rim.com>2012-08-06 13:44:38 -0400
committerDaniel Stenberg <daniel@haxx.se>2012-08-07 00:28:21 +0200
commit42e4c34ff37c259ff26e78aab22c0bccf06d1bcb (patch)
tree9749995ece5e99c0579618b1506782bc84a58b2f
parent0df14c83932b2022c3f424985d8e1fe51f7fb8f5 (diff)
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.
-rw-r--r--tests/data/DISABLED3
-rw-r--r--tests/server/sws.c6
2 files changed, 3 insertions, 6 deletions
diff --git a/tests/data/DISABLED b/tests/data/DISABLED
index 3765b79f6..5a0f2bf95 100644
--- a/tests/data/DISABLED
+++ b/tests/data/DISABLED
@@ -5,6 +5,3 @@
594
1209
1211
-2025
-2028
-2031
diff --git a/tests/server/sws.c b/tests/server/sws.c
index bff4a8771..151e0647f 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -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;
}