Browse Source

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

master
Felix von Leitner 17 years ago
parent
commit
0da1c0902d
2 changed files with 12 additions and 1 deletions
  1. +1
    -0
      CHANGES
  2. +11
    -1
      io/io_sendfile.c

+ 1
- 0
CHANGES View File

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


+ 11
- 1
io/io_sendfile.c View File

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