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
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment