Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6859BDC2A for ; Tue, 2 Oct 2012 13:07:32 +0000 (UTC) Received: (qmail 70357 invoked by uid 500); 2 Oct 2012 13:07:32 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 70045 invoked by uid 500); 2 Oct 2012 13:07:27 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 70018 invoked by uid 99); 2 Oct 2012 13:07:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Oct 2012 13:07:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Oct 2012 13:07:24 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5ACBB23888CD; Tue, 2 Oct 2012 13:06:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1392899 - in /httpd/httpd/branches/2.4.x: ./ STATUS modules/slotmem/mod_slotmem_shm.c Date: Tue, 02 Oct 2012 13:06:39 -0000 To: cvs@httpd.apache.org From: jim@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121002130640.5ACBB23888CD@eris.apache.org> Author: jim Date: Tue Oct 2 13:06:39 2012 New Revision: 1392899 URL: http://svn.apache.org/viewvc?rev=1392899&view=rev Log: Merge r1386822 from trunk: More consistent return errors... Reviewed/backported by: jim Modified: httpd/httpd/branches/2.4.x/ (props changed) httpd/httpd/branches/2.4.x/STATUS httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c Propchange: httpd/httpd/branches/2.4.x/ ------------------------------------------------------------------------------ Merged /httpd/httpd/trunk:r1386822 Modified: httpd/httpd/branches/2.4.x/STATUS URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1392899&r1=1392898&r2=1392899&view=diff ============================================================================== --- httpd/httpd/branches/2.4.x/STATUS (original) +++ httpd/httpd/branches/2.4.x/STATUS Tue Oct 2 13:06:39 2012 @@ -89,10 +89,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_slotmem_shm: Consistent and logical return errors - trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1386822 - 2.4.x patch: trunk patch works - +1: jim, humbedooh, trawick PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] Modified: httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c?rev=1392899&r1=1392898&r2=1392899&view=diff ============================================================================== --- httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c (original) +++ httpd/httpd/branches/2.4.x/modules/slotmem/mod_slotmem_shm.c Tue Oct 2 13:06:39 2012 @@ -477,7 +477,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; @@ -500,7 +500,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); @@ -524,7 +527,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); @@ -606,7 +612,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)++;