From cda9873e150c0febb1ee480fbdfab02ee345430d Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Mon, 5 May 1997 22:21:20 +0000 Subject: [PATCH] fix for mmap and restart_point git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1666 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftpd/ftpd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/appl/ftp/ftpd/ftpd.c b/appl/ftp/ftpd/ftpd.c index bf7929ac6..323332d15 100644 --- a/appl/ftp/ftpd/ftpd.c +++ b/appl/ftp/ftpd/ftpd.c @@ -1286,15 +1286,17 @@ send_data(FILE *instr, FILE *outstr, off_t blksize) #ifdef HAVE_MMAP { struct stat st; - void *chunk; + char *chunk; int in = fileno(instr); if(fstat(in, &st) == 0 && S_ISREG(st.st_mode)){ chunk = mmap(0, st.st_size, PROT_READ, MAP_SHARED, in, 0); 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); auth_write(fileno(outstr), NULL, 0); - cnt = st.st_size; byte_count = cnt; transflag = 0; }