Fossil SCM
Variable used for return value of send(2) must be signed, otherwise error conditions just result in infinite loops.
Commit
5e3519873fd4676cbda6b64d954cbc9f2fc7c0fe
Parent
9bfa186be09f3f9…
1 file changed
+3
-3
+3
-3
| --- src/http_socket.c | ||
| +++ src/http_socket.c | ||
| @@ -200,16 +200,16 @@ | ||
| 200 | 200 | |
| 201 | 201 | /* |
| 202 | 202 | ** Receive content back from the open socket connection. |
| 203 | 203 | */ |
| 204 | 204 | size_t socket_receive(void *NotUsed, void *pContent, size_t N){ |
| 205 | - size_t got; | |
| 205 | + ssize_t got; | |
| 206 | 206 | size_t total = 0; |
| 207 | 207 | while( N>0 ){ |
| 208 | 208 | got = recv(iSocket, pContent, N, 0); |
| 209 | 209 | if( got<=0 ) break; |
| 210 | - total += got; | |
| 211 | - N -= got; | |
| 210 | + total += (size_t)got; | |
| 211 | + N -= (size_t)got; | |
| 212 | 212 | pContent = (void*)&((char*)pContent)[got]; |
| 213 | 213 | } |
| 214 | 214 | return total; |
| 215 | 215 | } |
| 216 | 216 |
| --- src/http_socket.c | |
| +++ src/http_socket.c | |
| @@ -200,16 +200,16 @@ | |
| 200 | |
| 201 | /* |
| 202 | ** Receive content back from the open socket connection. |
| 203 | */ |
| 204 | size_t socket_receive(void *NotUsed, void *pContent, size_t N){ |
| 205 | size_t got; |
| 206 | size_t total = 0; |
| 207 | while( N>0 ){ |
| 208 | got = recv(iSocket, pContent, N, 0); |
| 209 | if( got<=0 ) break; |
| 210 | total += got; |
| 211 | N -= got; |
| 212 | pContent = (void*)&((char*)pContent)[got]; |
| 213 | } |
| 214 | return total; |
| 215 | } |
| 216 |
| --- src/http_socket.c | |
| +++ src/http_socket.c | |
| @@ -200,16 +200,16 @@ | |
| 200 | |
| 201 | /* |
| 202 | ** Receive content back from the open socket connection. |
| 203 | */ |
| 204 | size_t socket_receive(void *NotUsed, void *pContent, size_t N){ |
| 205 | ssize_t got; |
| 206 | size_t total = 0; |
| 207 | while( N>0 ){ |
| 208 | got = recv(iSocket, pContent, N, 0); |
| 209 | if( got<=0 ) break; |
| 210 | total += (size_t)got; |
| 211 | N -= (size_t)got; |
| 212 | pContent = (void*)&((char*)pContent)[got]; |
| 213 | } |
| 214 | return total; |
| 215 | } |
| 216 |