diff options
author | Yann Ylavic <ylavic@apache.org> | 2021-09-19 17:01:18 +0000 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2021-09-19 17:01:18 +0000 |
commit | 37b730ec3551d54405304100c6bcc0da829363ff (patch) | |
tree | 25e16b85fab62cd92ac23ebe535145b2369020a9 | |
parent | eeda16590cb6c03358708865ce625e0091a0cc32 (diff) | |
download | apr-37b730ec3551d54405304100c6bcc0da829363ff.tar.gz |
Partially merge r1893204, r1893445 from trunk:
There is no cleanup with APR_FOPEN_NOCLEANUP, so apr_pool_cleanup_kill() can
go in the !(old_file->flags & APR_FOPEN_NOCLEANUP) block.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1893446 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/os2/filedup.c | 5 | ||||
-rw-r--r-- | file_io/unix/filedup.c | 4 | ||||
-rw-r--r-- | file_io/win32/filedup.c | 5 |
3 files changed, 6 insertions, 8 deletions
diff --git a/file_io/os2/filedup.c b/file_io/os2/filedup.c index 0d987da9d..86f06f3c0 100644 --- a/file_io/os2/filedup.c +++ b/file_io/os2/filedup.c @@ -112,14 +112,13 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, } if (!(old_file->flags & APR_FOPEN_NOCLEANUP)) { + apr_pool_cleanup_kill(old_file->pool, (void *)old_file, + apr_file_cleanup); apr_pool_cleanup_register(p, (void *)(*new_file), apr_file_cleanup, apr_file_cleanup); } old_file->filedes = -1; - apr_pool_cleanup_kill(old_file->pool, (void *)old_file, - apr_file_cleanup); - return APR_SUCCESS; } diff --git a/file_io/unix/filedup.c b/file_io/unix/filedup.c index 41cfec568..97d11b620 100644 --- a/file_io/unix/filedup.c +++ b/file_io/unix/filedup.c @@ -164,6 +164,8 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, (*new_file)->fname = apr_pstrdup(p, old_file->fname); } if (!(old_file->flags & APR_FOPEN_NOCLEANUP)) { + apr_pool_cleanup_kill(old_file->pool, (void *)old_file, + apr_unix_file_cleanup); apr_pool_cleanup_register(p, (void *)(*new_file), apr_unix_file_cleanup, ((*new_file)->flags & APR_INHERIT) @@ -172,8 +174,6 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, } old_file->filedes = -1; - apr_pool_cleanup_kill(old_file->pool, (void *)old_file, - apr_unix_file_cleanup); #ifndef WAITIO_USES_POLL (*new_file)->pollset = NULL; #endif diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c index eaafaff42..662786421 100644 --- a/file_io/win32/filedup.c +++ b/file_io/win32/filedup.c @@ -211,15 +211,14 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, (*new_file)->fname = apr_pstrdup(p, old_file->fname); } if (!(old_file->flags & APR_FOPEN_NOCLEANUP)) { + apr_pool_cleanup_kill(old_file->pool, (void *)old_file, + file_cleanup); apr_pool_cleanup_register(p, (void *)(*new_file), file_cleanup, file_cleanup); } old_file->filehand = INVALID_HANDLE_VALUE; - apr_pool_cleanup_kill(old_file->pool, (void *)old_file, - file_cleanup); - #if APR_FILES_AS_SOCKETS /* Create a pollset with room for one descriptor. */ /* ### check return codes */ |