Skip to content
Snippets Groups Projects
Commit cc63360c authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Some more Coverity paranoia.

This ones does require SSIZE_MAX... so let's see what the pipes say...
parent 1c0d9f01
Branches
Tags
No related merge requests found
......@@ -188,17 +188,20 @@ off_t sendfilesocket(int sock, int file, off_t *offset, off_t count)
}
while(total<count) {
rd=read(file,buf,sizeof(buf));
if(rd==-1)
rd = read(file, buf, sizeof(buf));
if (rd < 0)
return(-1);
if(rd==0)
if (rd == 0)
break;
for(i=wr=0;i<rd;i+=wr) {
wr=sendsocket(sock,buf+i,rd-i);
if(wr>0)
for (i = wr = 0; i < rd; i += wr) {
wr = sendsocket(sock,buf+i,rd-i);
if (wr > 0) {
if ((SSIZE_MAX - i) < wr)
wr = SSIZE_MAX - i;
continue;
if(wr==SOCKET_ERROR && SOCKET_ERRNO==EWOULDBLOCK) {
wr=0;
}
if (wr == SOCKET_ERROR && SOCKET_ERRNO == EWOULDBLOCK) {
wr = 0;
SLEEP(1);
continue;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment