Skip to content
Snippets Groups Projects
Commit 364207ee authored by rswindell's avatar rswindell
Browse files

Cleaned-up sendfilesocket() - possible use of variable (wr) without

initialization, sanity checking of count, etc.
parent 970288c8
No related branches found
No related tags found
No related merge requests found
......@@ -87,8 +87,13 @@ int sendfilesocket(int sock, int file, long *offset, long count)
count-=tell(file); /* don't try to read beyond EOF */
}
if(count<0) {
errno=EINVAL;
return(-1);
}
total=0;
while(total!=count) {
while(total<count) {
rd=read(file,buf,sizeof(buf));
if(rd==-1)
return(-1);
......@@ -113,9 +118,6 @@ int sendfilesocket(int sock, int file, long *offset, long count)
if(offset!=NULL)
(*offset)+=total;
if(wr<1)
return(wr);
return(total);
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment