httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/experimental mod_mmap_static.c
Date Wed, 05 Jul 2000 19:14:00 GMT
trawick     00/07/05 12:13:59

  Modified:    src/modules/experimental mod_mmap_static.c
  Log:
  Change mod_mmap_static to use pools which are guaranteed to be defined at
  config command parsing time.   It was using a global which wasn't explicitly
  set to a valid pool until post config time (after it was used).  So on the
  first pass the "pool" was 0, causing ap_palloc to malloc storage which was
  never cleaned up.  On the second pass, it used the config pool from the first
  pass, which it got away with, but is living dangerously.
  Submitted by:	Greg Ames
  Reviewed by:	Jeff Trawick
  
  Revision  Changes    Path
  1.17      +4 -5      apache-2.0/src/modules/experimental/mod_mmap_static.c
  
  Index: mod_mmap_static.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/experimental/mod_mmap_static.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- mod_mmap_static.c	2000/07/03 16:36:56	1.16
  +++ mod_mmap_static.c	2000/07/05 19:13:58	1.17
  @@ -136,7 +136,6 @@
       char *filename;
       ap_finfo_t finfo;
   } a_file;
  -ap_pool_t *context;
   
   typedef struct {
       ap_array_header_t *files;
  @@ -174,7 +173,7 @@
       a_file tmp;
       ap_file_t *fd = NULL;
   
  -    if (ap_stat(&tmp.finfo, filename, context) != APR_SUCCESS) {
  +    if (ap_stat(&tmp.finfo, filename, cmd->temp_pool) != APR_SUCCESS) {
   	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server,
   	    "mmap_static: unable to stat(%s), skipping", filename);
   	return NULL;
  @@ -184,12 +183,13 @@
   	    "mmap_static: %s isn't a regular file, skipping", filename);
   	return NULL;
       }
  -    if (ap_open(&fd, filename, APR_READ, APR_OS_DEFAULT, context) != APR_SUCCESS) {
  +    if (ap_open(&fd, filename, APR_READ, APR_OS_DEFAULT, cmd->temp_pool) 
  +        != APR_SUCCESS) {
   	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server,
   	    "mmap_static: unable to open(%s, O_RDONLY), skipping", filename);
   	return NULL;
       }
  -    if (ap_mmap_create(&tmp.mm, fd, 0, tmp.finfo.size, context) != APR_SUCCESS) {
  +    if (ap_mmap_create(&tmp.mm, fd, 0, tmp.finfo.size, cmd->pool) != APR_SUCCESS)
{
   	int save_errno = errno;
   	ap_close(fd);
   	errno = save_errno;
  @@ -224,7 +224,6 @@
       a_file *elts;
       int nelts;
       
  -    context = p;    
       /* sort the elements of the main_server, by filename */
       sconf = ap_get_module_config(s->module_config, &mmap_static_module);
       elts = (a_file *)sconf->files->elts;
  
  
  

Mime
View raw message