diff options
author | joq <joq@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2004-12-13 19:39:54 +0000 |
---|---|---|
committer | joq <joq@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2004-12-13 19:39:54 +0000 |
commit | 17623df33b9ac29894be86c4a673e2aed519fa03 (patch) | |
tree | a4e808ef84c6633f2150095e9dfde4931782792a /libjack/shm.c | |
parent | 272d1f7bc02863b35df914aba502ef7864718403 (diff) | |
download | jack1-17623df33b9ac29894be86c4a673e2aed519fa03.tar.gz |
[0.99.35] always ftruncate() POSIX shm registry
git-svn-id: svn+ssh://jackaudio.org/trunk/jack@844 0c269be4-1314-0410-8aa9-9f06e86f4224
Diffstat (limited to 'libjack/shm.c')
-rw-r--r-- | libjack/shm.c | 17 |
1 files changed, 7 insertions, 10 deletions
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, |