Blame SOURCES/apr-1.4.8-r1561395.patch

e37861
e37861
https://svn.apache.org/viewvc?view=revision&revision=1561395
e37861
e37861
--- apr-1.4.8/shmem/unix/shm.c.r1561395
e37861
+++ apr-1.4.8/shmem/unix/shm.c
e37861
@@ -20,6 +20,18 @@
e37861
 #include "apr_errno.h"
e37861
 #include "apr_user.h"
e37861
 #include "apr_strings.h"
e37861
+#include "apr_hash.h"
e37861
+
e37861
+#if APR_USE_SHMEM_SHMGET
e37861
+static key_t our_ftok(const char *filename)
e37861
+{
e37861
+    /* to help avoid collisions while still using
e37861
+     * an easily recreated proj_id */
e37861
+    apr_ssize_t slen = strlen(filename);
e37861
+    return ftok(filename,
e37861
+                (int)apr_hashfunc_default(filename, &slen));
e37861
+}
e37861
+#endif
e37861
 
e37861
 static apr_status_t shm_cleanup_owner(void *m_)
e37861
 {
e37861
@@ -312,7 +324,7 @@
e37861
 
e37861
         /* ftok() (on solaris at least) requires that the file actually
e37861
          * exist before calling ftok(). */
e37861
-        shmkey = ftok(filename, 1);
e37861
+        shmkey = our_ftok(filename);
e37861
         if (shmkey == (key_t)-1) {
e37861
             return errno;
e37861
         }
e37861
@@ -386,7 +398,7 @@
e37861
 
e37861
     /* ftok() (on solaris at least) requires that the file actually
e37861
      * exist before calling ftok(). */
e37861
-    shmkey = ftok(filename, 1);
e37861
+    shmkey = our_ftok(filename);
e37861
     if (shmkey == (key_t)-1) {
e37861
         goto shm_remove_failed;
e37861
     }
e37861
@@ -540,7 +552,7 @@
e37861
 
e37861
         new_m->filename = apr_pstrdup(pool, filename);
e37861
         new_m->pool = pool;
e37861
-        shmkey = ftok(filename, 1);
e37861
+        shmkey = our_ftok(filename);
e37861
         if (shmkey == (key_t)-1) {
e37861
             return errno;
e37861
         }