Author: mturk Date: Fri Mar 17 02:39:10 2006 New Revision: 386604 URL: http://svn.apache.org/viewcvs?rev=386604&view=rev Log: Fix #37469. Shared memory was closed for forked childs, thus causing close an munmap twice for the same file id.
Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.c tomcat/connectors/trunk/jk/xdocs/changelog.xml Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.c URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jk/native/common/jk_shm.c?rev=386604&r1=386603&r2=386604&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_shm.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_shm.c Fri Mar 17 02:39:10 2006 @@ -253,7 +253,10 @@ return 0; } jk_shmem.filename = fname; - jk_shmem.attached = attached; + if (attached) + jk_shmem.attached = (int)getpid(); + else + jk_shmem.attached = 0; jk_shmem.size = JK_SHM_ALIGN(sizeof(jk_shm_header_t) + sz); @@ -361,6 +364,16 @@ { int rc; if (jk_shmem.hdr) { + if (jk_shmem.hdr.attached) { + int p = (int)getpid(); + if (p != jk_shmem.hdr.attached) { + /* In case this is a forked child + * do not close the shared memory. + * It will be closed by the parent. + */ + return; + } + } if (jk_shmem.fd_lock >= 0) { close(jk_shmem.fd_lock); } Modified: tomcat/connectors/trunk/jk/xdocs/changelog.xml URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jk/xdocs/changelog.xml?rev=386604&r1=386603&r2=386604&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/changelog.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/changelog.xml Fri Mar 17 02:39:10 2006 @@ -26,6 +26,10 @@ <subsection name="Native"> <changelog> <fix> + <bug>37469</bug>: Fix shared memory close for forked childs. + The shared memory will be closed by the parent process. (mturk) + </fix> + <fix> <bug>37332</bug>: Fix potential misuse of buffer length with snprintf functions. (mturk) </fix> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]