apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject svn commit: r661146 - in /apr/apr/trunk: include/arch/unix/apr_arch_shm.h shmem/unix/shm.c
Date Wed, 28 May 2008 23:33:01 GMT
Author: bojan
Date: Wed May 28 16:33:00 2008
New Revision: 661146

URL: http://svn.apache.org/viewvc?rev=661146&view=rev
Log:
If the named resource was removed by apr_shm_remove(), it may not be there.

Modified:
    apr/apr/trunk/include/arch/unix/apr_arch_shm.h
    apr/apr/trunk/shmem/unix/shm.c

Modified: apr/apr/trunk/include/arch/unix/apr_arch_shm.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/unix/apr_arch_shm.h?rev=661146&r1=661145&r2=661146&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/unix/apr_arch_shm.h (original)
+++ apr/apr/trunk/include/arch/unix/apr_arch_shm.h Wed May 28 16:33:00 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/trunk/shmem/unix/shm.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/shmem/unix/shm.c?rev=661146&r1=661145&r2=661146&view=diff
==============================================================================
--- apr/apr/trunk/shmem/unix/shm.c (original)
+++ apr/apr/trunk/shmem/unix/shm.c Wed May 28 16:33:00 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) {
@@ -70,7 +75,12 @@
         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
     }
 



Mime
View raw message