diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-09-24 22:25:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-09-24 22:25:57 +0000 |
commit | cb080247ac32a846f72554a371ca69e3dd9080da (patch) | |
tree | 22e1c8621f8d1135ade4a3fb501a02089487659f | |
parent | b7846948995576e768ce89d2cd0dd04d1e64de13 (diff) | |
download | libextractor-cb080247ac32a846f72554a371ca69e3dd9080da.tar.gz libextractor-cb080247ac32a846f72554a371ca69e3dd9080da.zip |
-check if SHM creation failed, reduce SHM name length as OSX limits to 31 characters
-rw-r--r-- | src/main/extractor.c | 5 | ||||
-rw-r--r-- | src/main/extractor_ipc_gnu.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/main/extractor.c b/src/main/extractor.c index b5db010..90db784 100644 --- a/src/main/extractor.c +++ b/src/main/extractor.c | |||
@@ -636,6 +636,11 @@ EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins, | |||
636 | { | 636 | { |
637 | /* need to create shared memory segment */ | 637 | /* need to create shared memory segment */ |
638 | shm = EXTRACTOR_IPC_shared_memory_create_ (DEFAULT_SHM_SIZE); | 638 | shm = EXTRACTOR_IPC_shared_memory_create_ (DEFAULT_SHM_SIZE); |
639 | if (NULL == shm) | ||
640 | { | ||
641 | LOG ("Failed to setup IPC\n"); | ||
642 | return; | ||
643 | } | ||
639 | } | 644 | } |
640 | for (pos = plugins; NULL != pos; pos = pos->next) | 645 | for (pos = plugins; NULL != pos; pos = pos->next) |
641 | if ( (NULL == pos->channel) && | 646 | if ( (NULL == pos->channel) && |
diff --git a/src/main/extractor_ipc_gnu.c b/src/main/extractor_ipc_gnu.c index 186026b..0e583e5 100644 --- a/src/main/extractor_ipc_gnu.c +++ b/src/main/extractor_ipc_gnu.c | |||
@@ -149,7 +149,7 @@ EXTRACTOR_IPC_shared_memory_create_ (size_t size) | |||
149 | #endif | 149 | #endif |
150 | snprintf (shm->shm_name, | 150 | snprintf (shm->shm_name, |
151 | MAX_SHM_NAME, | 151 | MAX_SHM_NAME, |
152 | "%slibextractor-shm-%u-%u", | 152 | "%sLE-%u-%u", |
153 | tpath, getpid (), | 153 | tpath, getpid (), |
154 | (unsigned int) RANDOM()); | 154 | (unsigned int) RANDOM()); |
155 | if (-1 == (shm->shm_id = shm_open (shm->shm_name, | 155 | if (-1 == (shm->shm_id = shm_open (shm->shm_name, |