apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/mmap/win32 mmap.c
Date Thu, 21 Feb 2002 00:01:15 GMT
wrowe       02/02/20 16:01:15

  Modified:    mmap/win32 mmap.c
  Log:
    Fix a Win32 segfault in mod_ssl, since ssl used file bucket to mmap
    transformation to process input.
  
  Revision  Changes    Path
  1.10      +8 -9      apr/mmap/win32/mmap.c
  
  Index: mmap.c
  ===================================================================
  RCS file: /home/cvs/apr/mmap/win32/mmap.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mmap.c	25 Jan 2002 20:50:32 -0000	1.9
  +++ mmap.c	21 Feb 2002 00:01:15 -0000	1.10
  @@ -130,24 +130,23 @@
       
       *new = apr_pcalloc(cont, sizeof(apr_mmap_t));
       (*new)->pstart = (offset / memblock) * memblock;
  -    (*new)->psize = (apr_size_t)(offset % memblock) + size;
       (*new)->poffset = offset - (*new)->pstart;
  -    /* XXX: psize below should be the MAXIMUM size of the mmap object,
  -     * (e.g. file size) not the size of the mapped region!
  -     * Since apr doesn't seem to acknowledge the discrepancy (the mmap
  -     * size/view/off concepts are pretty horked) this will have to wait.
  +    (*new)->psize = (apr_size_t)((*new)->poffset) + size;
  +    /* The size of the CreateFileMapping object is the current size
  +     * of the size of the mmap object (e.g. file size), not the size 
  +     * of the mapped region!
        */
   
       (*new)->mhandle = CreateFileMapping(file->filehand, NULL, fmaccess,
  -                                        0, (*new)->psize, NULL);
  +                                        0, 0, NULL);
       if (!(*new)->mhandle || (*new)->mhandle == INVALID_HANDLE_VALUE)
       {
           *new = NULL;
           return apr_get_os_error();
       }
   
  -    offlo = (DWORD)(*new)->poffset;
  -    offhi = (DWORD)((*new)->poffset << 32);
  +    offlo = (DWORD)(*new)->pstart;
  +    offhi = (DWORD)((*new)->pstart >> 32);
       (*new)->mv = MapViewOfFile((*new)->mhandle, mvaccess, offhi,
                                  offlo, (*new)->psize);
       if (!(*new)->mv)
  @@ -158,7 +157,7 @@
           return rv;
       }
   
  -    (*new)->mm = (char*)((*new)->mv) + offset;
  +    (*new)->mm = (char*)((*new)->mv) + (*new)->poffset;
       (*new)->size = size;
       (*new)->cntxt = cont;
       (*new)->is_owner = 1;
  
  
  

Mime
View raw message