summaryrefslogtreecommitdiff
path: root/shmem
diff options
context:
space:
mode:
authorJim Jagielski <jim@apache.org>2013-11-17 14:18:25 +0000
committerJim Jagielski <jim@apache.org>2013-11-17 14:18:25 +0000
commit5b5b9012fa5a958fb7b4d1f17d4960e3f1e76b58 (patch)
tree68f3c27cdf62c345a8612a01c1c954b474e322b5 /shmem
parent8853d02866c4148f92bf211e47d79ee4bb665ec2 (diff)
downloadapr-5b5b9012fa5a958fb7b4d1f17d4960e3f1e76b58.tar.gz
Close https://issues.apache.org/bugzilla/show_bug.cgi?id=53996
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1542728 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'shmem')
-rw-r--r--shmem/unix/shm.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/shmem/unix/shm.c b/shmem/unix/shm.c
index f907000c8..27a29e67c 100644
--- a/shmem/unix/shm.c
+++ b/shmem/unix/shm.c
@@ -21,6 +21,7 @@
#include "apr_errno.h"
#include "apr_user.h"
#include "apr_strings.h"
+#include "apr_hash.h"
static apr_status_t shm_cleanup_owner(void *m_)
{
@@ -103,6 +104,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
#endif
#if APR_USE_SHMEM_SHMGET
apr_size_t nbytes;
+ apr_ssize_t slen;
#endif
#if APR_USE_SHMEM_MMAP_ZERO || APR_USE_SHMEM_SHMGET || \
APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM
@@ -312,7 +314,9 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
/* ftok() (on solaris at least) requires that the file actually
* exist before calling ftok(). */
- new_m->shmkey = ftok(filename, 1);
+ slen = strlen(filename);
+ new_m->shmkey = ftok(filename,
+ (int)apr_hashfunc_default(filename, &slen));
if (new_m->shmkey == (key_t)-1) {
apr_file_close(file);
return errno;
@@ -382,6 +386,7 @@ APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename,
apr_file_t *file;
key_t shmkey;
int shmid;
+ apr_ssize_t slen;
#endif
#if APR_USE_SHMEM_MMAP_TMP
@@ -401,7 +406,9 @@ APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename,
/* ftok() (on solaris at least) requires that the file actually
* exist before calling ftok(). */
- shmkey = ftok(filename, 1);
+ slen = strlen(filename);
+ shmkey = ftok(filename,
+ (int)apr_hashfunc_default(filename, &slen));
if (shmkey == (key_t)-1) {
goto shm_remove_failed;
}
@@ -532,6 +539,7 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
apr_status_t status;
apr_file_t *file; /* file where metadata is stored */
apr_size_t nbytes;
+ apr_ssize_t slen;
new_m = apr_palloc(pool, sizeof(apr_shm_t));
@@ -554,7 +562,9 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
new_m->filename = apr_pstrdup(pool, filename);
new_m->pool = pool;
- new_m->shmkey = ftok(filename, 1);
+ slen = strlen(filename);
+ new_m->shmkey = ftok(filename,
+ (int)apr_hashfunc_default(filename, &slen));
if (new_m->shmkey == (key_t)-1) {
return errno;
}