fix for mmap and restart_point

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1666 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-05-05 22:21:20 +00:00
parent 0bf5e413ef
commit cda9873e15

View File

@@ -1286,15 +1286,17 @@ send_data(FILE *instr, FILE *outstr, off_t blksize)
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
{ {
struct stat st; struct stat st;
void *chunk; char *chunk;
int in = fileno(instr); int in = fileno(instr);
if(fstat(in, &st) == 0 && S_ISREG(st.st_mode)){ if(fstat(in, &st) == 0 && S_ISREG(st.st_mode)){
chunk = mmap(0, st.st_size, PROT_READ, MAP_SHARED, in, 0); chunk = mmap(0, st.st_size, PROT_READ, MAP_SHARED, in, 0);
if(chunk != NULL){ if(chunk != NULL){
auth_write(fileno(outstr), chunk, st.st_size); cnt = st.sz_size - restart_point;
auth_write(fileno(outstr),
chunk + restart_point,
cnt);
munmap(chunk, st.st_size); munmap(chunk, st.st_size);
auth_write(fileno(outstr), NULL, 0); auth_write(fileno(outstr), NULL, 0);
cnt = st.st_size;
byte_count = cnt; byte_count = cnt;
transflag = 0; transflag = 0;
} }