diff options
author | Jim Jagielski <jim@apache.org> | 2013-11-17 14:20:11 +0000 |
---|---|---|
committer | Jim Jagielski <jim@apache.org> | 2013-11-17 14:20:11 +0000 |
commit | 04178af77fadb5bf50d9e9bfe7c07a980a984484 (patch) | |
tree | 2e513c333ba83674692cc08161e6a07f5f1b6f17 /shmem/unix | |
parent | 4aff302b82ed7eb483b4b13f52b4442afd3c1026 (diff) | |
download | apr-04178af77fadb5bf50d9e9bfe7c07a980a984484.tar.gz |
https://issues.apache.org/bugzilla/show_bug.cgi?id=53996
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1542731 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'shmem/unix')
-rw-r--r-- | shmem/unix/shm.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/shmem/unix/shm.c b/shmem/unix/shm.c index 87a7ce045..b1b984357 100644 --- a/shmem/unix/shm.c +++ b/shmem/unix/shm.c @@ -20,6 +20,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, #if APR_USE_SHMEM_SHMGET apr_size_t nbytes; key_t shmkey; + 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(). */ - shmkey = ftok(filename, 1); + slen = strlen(filename); + shmkey = ftok(filename, + (int)apr_hashfunc_default(filename, &slen)); if (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; } @@ -533,6 +540,7 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, apr_file_t *file; /* file where metadata is stored */ apr_size_t nbytes; key_t shmkey; + apr_ssize_t slen; new_m = apr_palloc(pool, sizeof(apr_shm_t)); @@ -555,7 +563,9 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, new_m->filename = apr_pstrdup(pool, filename); new_m->pool = pool; - shmkey = ftok(filename, 1); + slen = strlen(filename); + shmkey = ftok(filename, + (int)apr_hashfunc_default(filename, &slen)); if (shmkey == (key_t)-1) { return errno; } |