You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bo...@apache.org on 2008/06/03 02:15:39 UTC
svn commit: r662604 - in /apr/apr/branches/1.3.x:
include/arch/unix/apr_arch_shm.h shmem/unix/shm.c
Author: bojan
Date: Mon Jun 2 17:15:38 2008
New Revision: 662604
URL: http://svn.apache.org/viewvc?rev=662604&view=rev
Log:
Backport r661146, 662114 and 662300 from the trunk.
If the named resource was removed by apr_shm_remove(), it may not be there.
Ignore EINVAL from shmctl in shm_cleanup_owner
This fixes the testcase, but doesn't feel like the end of the story:
both this and r661146 feel like sticking plaster over something deeper.
Modified:
apr/apr/branches/1.3.x/include/arch/unix/apr_arch_shm.h
apr/apr/branches/1.3.x/shmem/unix/shm.c
Modified: apr/apr/branches/1.3.x/include/arch/unix/apr_arch_shm.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/include/arch/unix/apr_arch_shm.h?rev=662604&r1=662603&r2=662604&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/include/arch/unix/apr_arch_shm.h (original)
+++ apr/apr/branches/1.3.x/include/arch/unix/apr_arch_shm.h Mon Jun 2 17:15:38 2008
@@ -27,6 +27,9 @@
#include "apr_network_io.h"
#include "apr_portable.h"
+#if APR_HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
Modified: apr/apr/branches/1.3.x/shmem/unix/shm.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/shmem/unix/shm.c?rev=662604&r1=662603&r2=662604&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/shmem/unix/shm.c (original)
+++ apr/apr/branches/1.3.x/shmem/unix/shm.c Mon Jun 2 17:15:38 2008
@@ -49,7 +49,12 @@
if (munmap(m->base, m->realsize) == -1) {
return errno;
}
- return apr_file_remove(m->filename, m->pool);
+ if (access(m->filename, F_OK)) {
+ return APR_SUCCESS;
+ }
+ else {
+ return apr_file_remove(m->filename, m->pool);
+ }
#endif
#if APR_USE_SHMEM_MMAP_SHM
if (munmap(m->base, m->realsize) == -1) {
@@ -64,13 +69,18 @@
/* Indicate that the segment is to be destroyed as soon
* as all processes have detached. This also disallows any
* new attachments to the segment. */
- if (shmctl(m->shmid, IPC_RMID, NULL) == -1) {
+ if (shmctl(m->shmid, IPC_RMID, NULL) == -1 && errno != EINVAL) {
return errno;
}
if (shmdt(m->base) == -1) {
return errno;
}
- return apr_file_remove(m->filename, m->pool);
+ if (access(m->filename, F_OK)) {
+ return APR_SUCCESS;
+ }
+ else {
+ return apr_file_remove(m->filename, m->pool);
+ }
#endif
}