From commits-return-9547-apmail-apr-commits-archive=apr.apache.org@apr.apache.org Wed May 21 04:56:31 2008 Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 12375 invoked from network); 21 May 2008 04:56:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 May 2008 04:56:30 -0000 Received: (qmail 43791 invoked by uid 500); 21 May 2008 04:56:32 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 43747 invoked by uid 500); 21 May 2008 04:56:32 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 43738 invoked by uid 99); 21 May 2008 04:56:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 May 2008 21:56:32 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Wed, 21 May 2008 04:55:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9D87C2388A3D; Tue, 20 May 2008 21:56:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r658554 - /apr/apr/branches/1.2.x/shmem/win32/shm.c Date: Wed, 21 May 2008 04:56:09 -0000 To: commits@apr.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080521045609.9D87C2388A3D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mturk Date: Tue May 20 21:56:09 2008 New Revision: 658554 URL: http://svn.apache.org/viewvc?rev=658554&view=rev Log: Backport r658105 from trunk Modified: apr/apr/branches/1.2.x/shmem/win32/shm.c Modified: apr/apr/branches/1.2.x/shmem/win32/shm.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/shmem/win32/shm.c?rev=658554&r1=658553&r2=658554&view=diff ============================================================================== --- apr/apr/branches/1.2.x/shmem/win32/shm.c (original) +++ apr/apr/branches/1.2.x/shmem/win32/shm.c Tue May 20 21:56:09 2008 @@ -18,6 +18,7 @@ #include "apr_errno.h" #include "apr_file_io.h" #include "apr_shm.h" +#include "apr_strings.h" #include "apr_arch_file_io.h" #include "limits.h" @@ -33,6 +34,7 @@ apr_size_t size; apr_size_t length; HANDLE hMap; + const char *filename; }; static apr_status_t shm_cleanup(void* shm) @@ -44,11 +46,13 @@ rv = apr_get_os_error(); } if (!CloseHandle(m->hMap)) { - return (rv != APR_SUCCESS) ? rv : apr_get_os_error(); + rv = rv != APR_SUCCESS ? rv : apr_get_os_error(); + } + if (m->filename) { + /* Remove file if file backed */ + apr_status_t rc = apr_file_remove(m->filename, m->pool); + rv = rv != APR_SUCCESS ? rv : rc; } - /* ### Do we want to make a point of unlinking m->file here? - * Need to add the fname to the apr_shm_t, in that case. - */ return rv; } @@ -159,6 +163,7 @@ (*m)->memblk->length = (*m)->length; (*m)->memblk->size = (*m)->size; + (*m)->filename = file ? apr_pstrdup(pool, file) : NULL; apr_pool_cleanup_register((*m)->pool, *m, shm_cleanup, apr_pool_cleanup_null); @@ -252,6 +257,8 @@ (*m)->hMap = hMap; (*m)->length = (*m)->memblk->length; (*m)->usrmem = (char*)base + sizeof(memblock_t); + (*m)->filename = NULL; + apr_pool_cleanup_register((*m)->pool, *m, shm_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; @@ -301,6 +308,7 @@ /* Real (*m)->mem->size could be recovered with VirtualQuery */ (*m)->size = (*m)->memblk->size; (*m)->length = (*m)->memblk->length; + (*m)->filename = NULL; apr_pool_cleanup_register((*m)->pool, *m, shm_cleanup, apr_pool_cleanup_null);