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/20 09:24:35 UTC

svn commit: r1893467 - in /apr/apr-util/branches/1.7.x: ./ crypto/apr_crypto.c

Author: ylavic
Date: Mon Sep 20 09:24:35 2021
New Revision: 1893467

URL: http://svn.apache.org/viewvc?rev=1893467&view=rev
Log:
Merge r1893466 from trunk:

apr_crypto: non-DSO drivers should have global lifetime too.

Same lifetime as the hashtable used by apr_crypto_get_driver() to cache the
drivers for reloads.

Submitted by: ylavic

Modified:
    apr/apr-util/branches/1.7.x/   (props changed)
    apr/apr-util/branches/1.7.x/crypto/apr_crypto.c

Propchange: apr/apr-util/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1893466

Modified: apr/apr-util/branches/1.7.x/crypto/apr_crypto.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.7.x/crypto/apr_crypto.c?rev=1893467&r1=1893466&r2=1893467&view=diff
==============================================================================
--- apr/apr-util/branches/1.7.x/crypto/apr_crypto.c (original)
+++ apr/apr-util/branches/1.7.x/crypto/apr_crypto.c Mon Sep 20 09:24:35 2021
@@ -221,8 +221,8 @@ APU_DECLARE(apr_status_t) apr_crypto_get
     char symname[34];
     apr_dso_handle_t *dso;
     apr_dso_handle_sym_t symbol;
-    apr_pool_t *rootp;
 #endif
+    apr_pool_t *rootp;
     apr_status_t rv;
 
     if (result) {
@@ -243,11 +243,11 @@ APU_DECLARE(apr_status_t) apr_crypto_get
         return APR_SUCCESS;
     }
 
-#if APU_DSO_BUILD
-    /* The driver DSO must have exactly the same lifetime as the
+    /* The driver must have exactly the same lifetime as the
      * drivers hash table; ignore the passed-in pool */
     rootp = apr_hash_pool_get(drivers);
 
+#if APU_DSO_BUILD
 #if defined(NETWARE)
     apr_snprintf(modname, sizeof(modname), "crypto%s.nlm", name);
 #elif defined(WIN32) || defined(__CYGWIN__)
@@ -289,6 +289,8 @@ APU_DECLARE(apr_status_t) apr_crypto_get
 #else /* not builtin and !APR_HAS_DSO => not implemented */
     rv = APR_ENOTIMPL;
 
+    pool = rootp; /* global lifetime (aligned to hash table) */
+
     /* Load statically-linked drivers: */
 #if APU_HAVE_OPENSSL
     if (!strcmp(name, "openssl")) {
@@ -322,7 +324,7 @@ APU_DECLARE(apr_status_t) apr_crypto_get
 #endif
     ;
 
-#endif /* !APR_HAVE_MODULAR_DSO */
+#endif /* !APU_DSO_BUILD */
 
     return rv;
 }