Browse Source

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

master
Felix von Leitner 18 years ago
parent
commit
0da1c0902d
  1. 1
      CHANGES
  2. 12
      io/io_sendfile.c

1
CHANGES

@ -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

12
io/io_sendfile.c

@ -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