]> granicus.if.org Git - apache/commitdiff
Fix mistaken reset of num_free with restored shm
authorJim Jagielski <jim@apache.org>
Wed, 9 Jan 2013 14:14:42 +0000 (14:14 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 9 Jan 2013 14:14:42 +0000 (14:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1430869 13f79535-47bb-0310-9956-ffa450edef68

modules/slotmem/mod_slotmem_shm.c

index 3959e93a8e1c5034428e534704f029ec03eb8209..ec089264508637c56e0a14ea3f0392e9ada8a3ad 100644 (file)
@@ -296,6 +296,7 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new,
 {
 /*    void *slotmem = NULL; */
     int fbased = 1;
+    int restored = 0;
     char *ptr;
     sharedslotdesc_t desc;
     ap_slotmem_instance_t *res;
@@ -390,6 +391,7 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new,
          */
         if (type & AP_SLOTMEM_TYPE_PERSIST) {
             restore_slotmem(ptr, fname, dsize, pool);
+            restored = 1;
         }
     }
 
@@ -400,7 +402,9 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new,
     res->fbased = fbased;
     res->shm = shm;
     res->num_free = (unsigned int *)ptr;
-    *res->num_free = item_num;
+    if (!restored) {
+        *res->num_free = item_num;
+    }
     res->persist = (void *)ptr;
     ptr += AP_UNSIGNEDINT_OFFSET;
     res->base = (void *)ptr;