Author: davi Date: Fri Oct 12 17:00:46 2007 New Revision: 584341 URL: http://svn.apache.org/viewvc?rev=584341&view=rev Log: Backport revision 584331 from trunk: The calls to UnmapViewOfFile() and CloseHandle() in the shm_cleanup() routine in the win32/shm.c source are not properly checking for errors. They currently assume a non-zero return is an error.Whereas these windows calls return non-zero on success and zero on failure. PR: 43065 Submitted by: Joe Mudd Modified: apr/apr/branches/1.2.x/CHANGES apr/apr/branches/1.2.x/shmem/win32/shm.c Modified: apr/apr/branches/1.2.x/CHANGES URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/CHANGES?rev=584341&r1=584340&r2=584341&view=diff ============================================================================== --- apr/apr/branches/1.2.x/CHANGES [utf-8] (original) +++ apr/apr/branches/1.2.x/CHANGES [utf-8] Fri Oct 12 17:00:46 2007 @@ -1,6 +1,10 @@  -*- coding: utf-8 -*- Changes for APR 1.2.12 + *) The WIN32 cleanup routine for shared memory segments could wrongly + return unknown errors and leak a open handle. + [Joe Mudd ] + *) apr_procattr_io_set() on Windows: Set pipe handles non-blocking as appropriate based on the input parameters. PR 43522. [Eric Covener ] 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=584341&r1=584340&r2=584341&view=diff ============================================================================== --- apr/apr/branches/1.2.x/shmem/win32/shm.c (original) +++ apr/apr/branches/1.2.x/shmem/win32/shm.c Fri Oct 12 17:00:46 2007 @@ -40,10 +40,10 @@ apr_status_t rv = APR_SUCCESS; apr_shm_t *m = shm; - if (UnmapViewOfFile(m->memblk)) { + if (!UnmapViewOfFile(m->memblk)) { rv = apr_get_os_error(); } - if (CloseHandle(m->hMap)) { + if (!CloseHandle(m->hMap)) { return (rv != APR_SUCCESS) ? rv : apr_get_os_error(); } /* ### Do we want to make a point of unlinking m->file here?