From 17623df33b9ac29894be86c4a673e2aed519fa03 Mon Sep 17 00:00:00 2001 From: joq Date: Mon, 13 Dec 2004 19:39:54 +0000 Subject: [PATCH] [0.99.35] always ftruncate() POSIX shm registry git-svn-id: svn+ssh://jackaudio.org/trunk/jack@844 0c269be4-1314-0410-8aa9-9f06e86f4224 --- configure.ac | 2 +- libjack/shm.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 8bbf932..9485218 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ dnl changes are made dnl --- JACK_MAJOR_VERSION=0 JACK_MINOR_VERSION=99 -JACK_MICRO_VERSION=34 +JACK_MICRO_VERSION=35 dnl --- dnl HOWTO: updating the jack protocol version diff --git a/libjack/shm.c b/libjack/shm.c index fe60f18..65ba326 100644 --- a/libjack/shm.c +++ b/libjack/shm.c @@ -465,13 +465,12 @@ jack_access_registry (jack_shm_info_t *ri) int shm_fd; int new_registry = 0; int rc = -1; - int perm; + int perm = O_RDWR; jack_shmsize_t size = JACK_SHM_REGISTRY_SIZE; /* grab a chunk of memory to store shm ids in. this is to allow clean up of all segments whenever JACK starts (or stops). */ - perm = O_RDWR; strncpy (registry_id, "/jack-shm-registry", sizeof (registry_id)); /* try without O_CREAT to see if it already exists */ @@ -497,14 +496,12 @@ jack_access_registry (jack_shm_info_t *ri) } } - if (perm & O_CREAT) { - if (ftruncate (shm_fd, size) < 0) { - jack_error ("cannot set size of engine shm registry 1" - "(%s)", strerror (errno)); - jack_remove_shm (®istry_id); - rc = -2; - goto error; - } + /* force the correct segment size */ + if (ftruncate (shm_fd, size) < 0) { + jack_error ("cannot set registry size (%s)", strerror (errno)); + jack_remove_shm (®istry_id); + rc = -2; + goto error; } if ((ri->attached_at = mmap (0, size, PROT_READ|PROT_WRITE,