rse 99/04/22 07:27:52
Modified: src/modules/proxy proxy_cache.c Log: Ouch! With the recent commits to proxy_cache.c horrible bugs were introduced: First the variable filename was a global static variable and at the same time a local variable (``declaration of `filename' shadows global declaration''). Second, the filename allocation at two locations used a ``strlen(cachedir)'' before ``cachedir'' was actually initialized! Revision Changes Path 1.59 +4 -2 apache-1.3/src/modules/proxy/proxy_cache.c Index: proxy_cache.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_cache.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- proxy_cache.c 1999/04/19 12:30:46 1.58 +++ proxy_cache.c 1999/04/22 14:27:51 1.59 @@ -103,7 +103,6 @@ static long block_size = 512; /* this must be a power of 2 */ static long61_t curbytes, cachesize; static time_t garbage_now, garbage_expire; -static char *filename; static mutex *garbage_mutex = NULL; @@ -348,10 +347,11 @@ const struct cache_conf *conf = &pconf->cache; array_header *files; struct gc_ent *fent; + char *filename; int i; - char *filename = ap_palloc(r->pool, strlen(cachedir) + HASH_LEN + 2); cachedir = conf->root; + filename = ap_palloc(r->pool, strlen(cachedir) + HASH_LEN + 2); /* configured size is given in kB. Make it bytes, convert to long61_t: */ cachesize.lower = cachesize.upper = 0; add_long61(&cachesize, conf->space << 10); @@ -416,8 +416,10 @@ #endif struct gc_ent *fent; int nfiles = 0; + char *filename; ap_snprintf(cachedir, sizeof(cachedir), "%s%s", cachebasedir, cachesubdir); + filename = ap_palloc(r->pool, strlen(cachedir) + HASH_LEN + 2); Explain1("GC Examining directory %s", cachedir); dir = opendir(cachedir); if (dir == NULL) {