Fossil SCM

Variable used for return value of send(2) must be signed, otherwise error conditions just result in infinite loops.

joerg 2011-10-01 20:50 trunk
Commit 5e3519873fd4676cbda6b64d954cbc9f2fc7c0fe
1 file changed +3 -3
--- src/http_socket.c
+++ src/http_socket.c
@@ -200,16 +200,16 @@
200200
201201
/*
202202
** Receive content back from the open socket connection.
203203
*/
204204
size_t socket_receive(void *NotUsed, void *pContent, size_t N){
205
- size_t got;
205
+ ssize_t got;
206206
size_t total = 0;
207207
while( N>0 ){
208208
got = recv(iSocket, pContent, N, 0);
209209
if( got<=0 ) break;
210
- total += got;
211
- N -= got;
210
+ total += (size_t)got;
211
+ N -= (size_t)got;
212212
pContent = (void*)&((char*)pContent)[got];
213213
}
214214
return total;
215215
}
216216
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button