jwoolley 01/06/18 14:57:12
Modified: buckets apr_buckets_file.c
Log:
Fix a bug whereby file_setaside() accidentally put the file back in the
same pool it started in. This bug would have been easy to miss because
the requested pool and the current pool were just called "pool" and "p".
This patch renames them to "reqpool" and "curpool" and uses "reqpool" where
needed to fix the bug.
Revision Changes Path
1.45 +5 -5 apr-util/buckets/apr_buckets_file.c
Index: apr_buckets_file.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_file.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -u -r1.44 -r1.45
--- apr_buckets_file.c 2001/06/16 03:54:57 1.44
+++ apr_buckets_file.c 2001/06/18 21:57:10 1.45
@@ -210,27 +210,27 @@
return apr_bucket_file_make(b, fd, offset, len);
}
-static apr_status_t file_setaside(apr_bucket *data, apr_pool_t *pool)
+static apr_status_t file_setaside(apr_bucket *data, apr_pool_t *reqpool)
{
apr_bucket_file *a = data->data;
apr_file_t *fd;
apr_file_t *f = a->fd;
- apr_pool_t *p = apr_file_pool_get(f);
+ apr_pool_t *curpool = apr_file_pool_get(f);
#if APR_HAS_MMAP
apr_off_t filelength = data->length; /* bytes remaining in file past
offset */
apr_off_t fileoffset = data->start;
#endif
- if (apr_pool_is_ancestor(p, pool)) {
+ if (apr_pool_is_ancestor(curpool, reqpool)) {
return APR_SUCCESS;
}
#if APR_HAS_MMAP
- if (file_make_mmap(data, filelength, fileoffset, p)) {
+ if (file_make_mmap(data, filelength, fileoffset, reqpool)) {
return APR_SUCCESS;
}
#endif
- apr_file_dup(&fd, f, p);
+ apr_file_dup(&fd, f, reqpool);
a->fd = fd;
return APR_SUCCESS;
}