fix bug in mmap code path of io_sendfile (David Leadbeater)

master
leitner 21 years ago
parent 3fd4c515ae
commit 5e2141e9f6

@ -5,6 +5,7 @@
add man pages for libio, safemult
fix possible signal race in io_tryread and io_trywrite (Scott Lamb)
fix byte_rchr return value (Marcus Winkler)
fix bug in mmap code path of io_sendfile (David Leadbeater)
0.18:
make libowfat compile on BSD again (sorry, and thanks to everyone who

@ -139,15 +139,25 @@ int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) {
if (m==-1) {
e->canwrite=0;
e->next_write=-1;
return errno==EAGAIN?(sent?sent:-1):-3;
if (errno!=EAGAIN) {
munmap(e->mmapped,e->maplen);
e->mmapped=0;
return -3;
}
return sent?sent:-1;
}
if (m==0) return sent;
sent+=m;
left-=m;
bytes-=m;
off+=m;
c+=m;
}
} while (bytes);
if (e->mmapped) {
munmap(e->mmapped,e->maplen);
e->mmapped=0;
}
return sent;
}
readwrite:

Loading…
Cancel
Save