diff options
author | Jim Jagielski <jim@apache.org> | 2002-01-15 14:24:51 +0000 |
---|---|---|
committer | Jim Jagielski <jim@apache.org> | 2002-01-15 14:24:51 +0000 |
commit | f2ad431049fe48668f68b91184293a3fe0af96d0 (patch) | |
tree | 1421b95c8e98972b4b951f44084332fe42906aad /shmem | |
parent | 93da1694a54826e0ac11411afcfaf18282828da1 (diff) | |
download | apr-f2ad431049fe48668f68b91184293a3fe0af96d0.tar.gz |
Mark SysV anon shared memory segments for deletion,
so if we crash, they are removed
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62792 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'shmem')
-rw-r--r-- | shmem/unix/shm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/shmem/unix/shm.c b/shmem/unix/shm.c index 1ae3cfc3d..5041b30bd 100644 --- a/shmem/unix/shm.c +++ b/shmem/unix/shm.c @@ -194,6 +194,11 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, new_m->shmid = shmid; + /* Remove the segment once use count hits zero. */ + if (shmctl(shmid, IPC_RMID, NULL) == -1) { + return errno; + } + *m = new_m; return APR_SUCCESS; #endif /* APR_USE_SHMEM_SHMGET_ANON */ |