Blame SOURCES/apr-1.4.8-r1561395.patch

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