diff options
author | Yann Ylavic <ylavic@apache.org> | 2021-09-10 00:51:53 +0000 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2021-09-10 00:51:53 +0000 |
commit | 6e6613787d3a8cc24f60a758f7b29f28292ae488 (patch) | |
tree | baf6fe7009f35032e2d66639a87eac30856e7426 /file_io/os2 | |
parent | e80637be48a55828e2d453113d3ce12dc401bd8e (diff) | |
download | apr-6e6613787d3a8cc24f60a758f7b29f28292ae488.tar.gz |
apr_file_setaside: don't blindly kill the old cleanup and file descriptor.
There is no cleanup with APR_FOPEN_NOCLEANUP, so apr_pool_cleanup_kill() can
go in the !(old_file->flags & APR_FOPEN_NOCLEANUP) block.
The file descriptor can't be invalidated either, the file may be split in
multiple buckets and setting aside one shouldn't invalidate the others.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893204 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/os2')
-rw-r--r-- | file_io/os2/filedup.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/file_io/os2/filedup.c b/file_io/os2/filedup.c index ff937eb68..15040c7c6 100644 --- a/file_io/os2/filedup.c +++ b/file_io/os2/filedup.c @@ -113,14 +113,12 @@ 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; } |