httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1386822 - /httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
Date Mon, 17 Sep 2012 20:38:59 GMT
Author: jim
Date: Mon Sep 17 20:38:59 2012
New Revision: 1386822

URL: http://svn.apache.org/viewvc?rev=1386822&view=rev
Log:
More consistent return errors...

Modified:
    httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c

Modified: httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c?rev=1386822&r1=1386821&r2=1386822&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c (original)
+++ httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c Mon Sep 17 20:38:59 2012
@@ -489,7 +489,7 @@ static apr_status_t slotmem_dptr(ap_slot
         return APR_ENOSHMAVAIL;
     }
     if (id >= slot->desc.num) {
-        return APR_ENOSHMAVAIL;
+        return APR_EINVAL;
     }
 
     ptr = (char *)slot->base + slot->desc.size * id;
@@ -512,7 +512,10 @@ static apr_status_t slotmem_get(ap_slotm
     }
 
     inuse = slot->inuse + id;
-    if (id >= slot->desc.num || (AP_SLOTMEM_IS_PREGRAB(slot) && !*inuse)) {
+    if (id >= slot->desc.num) {
+        return APR_EINVAL;
+    }
+    if (AP_SLOTMEM_IS_PREGRAB(slot) && !*inuse) {
         return APR_NOTFOUND;
     }
     ret = slotmem_dptr(slot, id, &ptr);
@@ -536,7 +539,10 @@ static apr_status_t slotmem_put(ap_slotm
     }
 
     inuse = slot->inuse + id;
-    if (id >= slot->desc.num || (AP_SLOTMEM_IS_PREGRAB(slot) && !*inuse)) {
+    if (id >= slot->desc.num) {
+        return APR_EINVAL;
+    }
+    if (AP_SLOTMEM_IS_PREGRAB(slot) && !*inuse) {
         return APR_NOTFOUND;
     }
     ret = slotmem_dptr(slot, id, &ptr);
@@ -618,7 +624,11 @@ static apr_status_t slotmem_release(ap_s
                      "slotmem(%s) release failed. Num %u/inuse[%u] %d",
                      slot->name, slotmem_num_slots(slot),
                      id, (int)inuse[id]);
-        return APR_NOTFOUND;
+        if (id >= slot->desc.num) {
+            return APR_EINVAL;
+        } else {
+            return APR_NOTFOUND;
+        }
     }
     inuse[id] = 0;
     (*slot->num_free)++;



Mime
View raw message