the mmap+write version of io_sendfile sent too much at the end and/or

went into an infinite loop sometimes.
master
leitner 21 years ago
parent 25181575b6
commit 177e18f415

@ -128,6 +128,7 @@ int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) {
mapok: mapok:
c=(const char*)(e->mmapped)+(off&0xffff); c=(const char*)(e->mmapped)+(off&0xffff);
left=e->maplen-(off&0xffff); left=e->maplen-(off&0xffff);
if (left>bytes) left=bytes;
while (left>0) { while (left>0) {
m=write(out,c,left); m=write(out,c,left);
if (m==-1) { if (m==-1) {

Loading…
Cancel
Save