You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2021/09/19 17:01:18 UTC

svn commit: r1893446 - in /apr/apr/branches/1.7.x: ./ file_io/os2/filedup.c file_io/unix/filedup.c file_io/win32/filedup.c

Author: ylavic
Date: Sun Sep 19 17:01:18 2021
New Revision: 1893446

URL: http://svn.apache.org/viewvc?rev=1893446&view=rev
Log:
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

Modified:
    apr/apr/branches/1.7.x/   (props changed)
    apr/apr/branches/1.7.x/file_io/os2/filedup.c
    apr/apr/branches/1.7.x/file_io/unix/filedup.c
    apr/apr/branches/1.7.x/file_io/win32/filedup.c

Propchange: apr/apr/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1893204,1893445

Modified: apr/apr/branches/1.7.x/file_io/os2/filedup.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/file_io/os2/filedup.c?rev=1893446&r1=1893445&r2=1893446&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/file_io/os2/filedup.c (original)
+++ apr/apr/branches/1.7.x/file_io/os2/filedup.c Sun Sep 19 17:01:18 2021
@@ -112,14 +112,13 @@ APR_DECLARE(apr_status_t) apr_file_setas
     }
 
     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;
 }

Modified: apr/apr/branches/1.7.x/file_io/unix/filedup.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/file_io/unix/filedup.c?rev=1893446&r1=1893445&r2=1893446&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/file_io/unix/filedup.c (original)
+++ apr/apr/branches/1.7.x/file_io/unix/filedup.c Sun Sep 19 17:01:18 2021
@@ -164,6 +164,8 @@ APR_DECLARE(apr_status_t) apr_file_setas
         (*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_setas
     }
 
     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

Modified: apr/apr/branches/1.7.x/file_io/win32/filedup.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/file_io/win32/filedup.c?rev=1893446&r1=1893445&r2=1893446&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/file_io/win32/filedup.c (original)
+++ apr/apr/branches/1.7.x/file_io/win32/filedup.c Sun Sep 19 17:01:18 2021
@@ -211,15 +211,14 @@ APR_DECLARE(apr_status_t) apr_file_setas
         (*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 */