Here is a patch that makes apr_file_mktemp check for the
APR_FILE_NOCLEANUP flag and not register a cleanup passed in.
APR_FILE_NOCLEANUP is being used in other places, but
APR_FOPEN_NOCLEANUP might be a better choice.
Brian
Index: mktemp.c
===================================================================
--- mktemp.c (revision 520897)
+++ mktemp.c (working copy)
@@ -202,8 +202,10 @@
apr_os_file_put(fp, &fd, flags, p);
(*fp)->fname = apr_pstrdup(p, template);
- apr_pool_cleanup_register((*fp)->pool, (void *)(*fp),
- apr_unix_file_cleanup,
apr_unix_file_cleanup);
+ if (!(flag & APR_FILE_NOCLEANUP)) {
+ apr_pool_cleanup_register((*fp)->pool, (void *)(*fp),
+ apr_unix_file_cleanup,
apr_unix_file_cleanup);
+ }
#endif
return APR_SUCCESS;
}