Hi,
The attached patch is one possible solution for apr_dbd/dbm.c where this can occur with the present apr configuration. The same for() loop can be found in apr_crypto.c and apr_dso.c, but as these files are (atm) not included in the NetWare apr build, there is no change to these files proposed here.
Regards,
Norm

Hi,
Raised this some months ago but response was left than deafening, and
advice says 'have another go', so...

In apr\memory\unix\apr_pools.c:

APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool)
{
#ifdef NETWARE
/* On NetWare, don't return the global_pool, return the application pool
as the top most pool */
if (pool->parent == global_pool)
return pool;
else
#endif
return pool->parent;
}

in apr\dbd\apr_dbd.c:

for (parent = pool; parent; parent = apr_pool_parent_get(pool))
pool = parent;

Cannot see how NetWare can escape this loop if apr_pool_parent_get()
returns the same pool passed in to the function.

Either (in NetWare case):

- apr_pool_parent_get() has to return something other than the same
'pool' to allow the loop to exit, OR

- the loop needs to determine if it got the same pool back (at least in
NetWare case) and exit the loop.

Comments please.
Regards,
Norm



Index: dbd/apr_dbd.c
===================================================================
--- dbd/apr_dbd.c	(revision 1151299)
+++ dbd/apr_dbd.c	(working copy)
@@ -101,8 +101,17 @@
     }
 
     /* Top level pool scope, need process-scope lifetime */
-    for (parent = pool;  parent; parent = apr_pool_parent_get(pool))
-         pool = parent;
+    parent = pool;
+    while (parent) {
+        pool = parent;
+        parent = apr_pool_parent_get(pool);
+#ifdef NETWARE
+        /* On NetWare, if parent returned == pool, we're at the top */
+        if (parent == pool)
+            break;
+#endif
+    }
+
 #if APR_HAVE_MODULAR_DSO
     /* deprecate in 2.0 - permit implicit initialization */
     apu_dso_init(pool);
Index: dbm/apr_dbm.c
===================================================================
--- dbm/apr_dbm.c	(revision 1151299)
+++ dbm/apr_dbm.c	(working copy)
@@ -129,8 +129,16 @@
         apr_pool_t *parent;
 
         /* Top level pool scope, need process-scope lifetime */
-        for (parent = pool;  parent; parent = apr_pool_parent_get(pool))
-             pool = parent;
+        parent = pool;
+        while (parent) {
+            pool = parent;
+            parent = apr_pool_parent_get(pool);
+#ifdef NETWARE
+            /* On NetWare, if parent returned == pool, we're at the top */
+            if (parent == pool)
+                break;
+#endif
+        }
 
         /* deprecate in 2.0 - permit implicit initialization */
         apu_dso_init(pool);

Reply via email to