From: Jean-Frederic Clere Date: Mon, 6 Jul 2009 11:39:47 +0000 (+0000) Subject: Arrange the slotmem chain logic in attach() too. X-Git-Tag: 2.3.3~474 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ba2f2e285569479a5e871ff39f25b8e75eeed6a;p=apache Arrange the slotmem chain logic in attach() too. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@791448 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/slotmem/mod_slotmem_shm.c b/modules/slotmem/mod_slotmem_shm.c index 3b5f326614..4100bd4977 100644 --- a/modules/slotmem/mod_slotmem_shm.c +++ b/modules/slotmem/mod_slotmem_shm.c @@ -372,15 +372,20 @@ static apr_status_t slotmem_attach(ap_slotmem_instance_t **new, } /* first try to attach to existing slotmem */ - while (next) { - if (strcmp(next->name, fname) == 0) { - /* we already have it */ - *new = next; - *item_size = next->desc.size; - *item_num = next->desc.num; - return APR_SUCCESS; + if (next) { + for (;;) { + if (strcmp(next->name, fname) == 0) { + /* we already have it */ + *new = next; + *item_size = next->desc.size; + *item_num = next->desc.num; + return APR_SUCCESS; + } + if (!next->next) { + break; + } + next = next->next; } - next = next->next; } /* first try to attach to existing shared memory */