diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-06-01 17:58:04 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2007-06-01 17:58:04 +0000 |
commit | 795a5af5aa0a712f8c60f47300864029eaa4ebdb (patch) | |
tree | eb33ef073c3e48247fb1ebe4dc3aa0938314e751 /file_io | |
parent | 75dc941c443c21e28f7ff20adc09bbf77df4509f (diff) | |
download | libapr-795a5af5aa0a712f8c60f47300864029eaa4ebdb.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
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@543555 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r-- | file_io/netware/mktemp.c | 9 | ||||
-rw-r--r-- | file_io/unix/mktemp.c | 8 |
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; } |