summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2007-06-01 17:58:33 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2007-06-01 17:58:33 +0000
commitdab7ca8b0e3edf3f6cc5d72bda7c3d2a0f70e16d (patch)
treebefaf1964f7f0cfdfdae5e4329a1b69185c3d316
parent44829cc58095b6eccbdec6f69df653ec0e262781 (diff)
downloadlibapr-dab7ca8b0e3edf3f6cc5d72bda7c3d2a0f70e16d.tar.gz
Register a cleanup only if APR_FILE_NOCLEANUP was not flagged.
Submitted by: Brian J. France <list firehawksystems.com> Reviewed by: wrowe, bojan Backport: 543555 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.2.x@543556 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--file_io/netware/mktemp.c9
-rw-r--r--file_io/unix/mktemp.c8
2 files changed, 11 insertions, 6 deletions
diff --git a/file_io/netware/mktemp.c b/file_io/netware/mktemp.c
index 745eff784..2a71af7d6 100644
--- a/file_io/netware/mktemp.c
+++ b/file_io/netware/mktemp.c
@@ -41,9 +41,12 @@ APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_i
if ((rv = apr_file_open(fp, template, flags|APR_FILE_NOCLEANUP,
APR_UREAD | APR_UWRITE, p)) == APR_SUCCESS) {
- apr_pool_cleanup_register((*fp)->pool, (void *)(*fp),
- apr_unix_file_cleanup,
- apr_unix_child_file_cleanup);
+
+ if (!(flags & APR_FILE_NOCLEANUP)) {
+ apr_pool_cleanup_register((*fp)->pool, (void *)(*fp),
+ apr_unix_file_cleanup,
+ apr_unix_child_file_cleanup);
+ }
}
return rv;
diff --git a/file_io/unix/mktemp.c b/file_io/unix/mktemp.c
index 8ac2f91bf..22e0bd5d3 100644
--- a/file_io/unix/mktemp.c
+++ b/file_io/unix/mktemp.c
@@ -202,9 +202,11 @@ APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_i
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_child_file_cleanup);
+ if (!(flags & APR_FILE_NOCLEANUP)) {
+ apr_pool_cleanup_register((*fp)->pool, (void *)(*fp),
+ apr_unix_file_cleanup,
+ apr_unix_child_file_cleanup);
+ }
#endif
return APR_SUCCESS;
}