Blame SOURCES/apr-1.4.8-r1561395.patch

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