aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-10-15 20:41:16 +0200
committerChristian Grothoff <christian@grothoff.org>2017-10-15 20:42:29 +0200
commitf675653eefe612dae726104914a2da451ea77077 (patch)
treec796b79ff5c0382c8347877fb1ec48e7ed05b96c
parent774014cdbdf1e5565ff3ad16cb9e8c983ed06369 (diff)
downloadlibextractor-f675653eefe612dae726104914a2da451ea77077.tar.gz
libextractor-f675653eefe612dae726104914a2da451ea77077.zip
do not try to seek on SHM if we do not use SHM, even if (bad) plugin requests it
-rw-r--r--src/main/extractor.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/extractor.c b/src/main/extractor.c
index b51af84..c35ebd8 100644
--- a/src/main/extractor.c
+++ b/src/main/extractor.c
@@ -360,7 +360,7 @@ in_process_proc (void *cls,
360 * all plugins are in-process) 360 * all plugins are in-process)
361 * @param ds data to process 361 * @param ds data to process
362 * @param proc function to call for each meta data item found 362 * @param proc function to call for each meta data item found
363 * @param proc_cls cls argument to proc 363 * @param proc_cls cls argument to @a proc
364 */ 364 */
365static void 365static void
366do_extract (struct EXTRACTOR_PluginList *plugins, 366do_extract (struct EXTRACTOR_PluginList *plugins,
@@ -387,7 +387,10 @@ do_extract (struct EXTRACTOR_PluginList *plugins,
387 for (pos = plugins; NULL != pos; pos = pos->next) 387 for (pos = plugins; NULL != pos; pos = pos->next)
388 plugin_count++; 388 plugin_count++;
389 if (NULL != shm) 389 if (NULL != shm)
390 ready = EXTRACTOR_IPC_shared_memory_set_ (shm, ds, 0, DEFAULT_SHM_SIZE); 390 ready = EXTRACTOR_IPC_shared_memory_set_ (shm,
391 ds,
392 0,
393 DEFAULT_SHM_SIZE);
391 else 394 else
392 ready = 0; 395 ready = 0;
393 have_in_memory = 0; 396 have_in_memory = 0;
@@ -500,7 +503,8 @@ do_extract (struct EXTRACTOR_PluginList *plugins,
500 } 503 }
501 data_available = -1; 504 data_available = -1;
502 if ( (1 == done) && 505 if ( (1 == done) &&
503 (-1 != min_seek) ) 506 (-1 != min_seek) &&
507 (NULL != shm) )
504 { 508 {
505 /* current position done, but seek requested */ 509 /* current position done, but seek requested */
506 done = 0; 510 done = 0;
@@ -642,6 +646,7 @@ EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins,
642 } 646 }
643 for (pos = plugins; NULL != pos; pos = pos->next) 647 for (pos = plugins; NULL != pos; pos = pos->next)
644 if ( (NULL == pos->channel) && 648 if ( (NULL == pos->channel) &&
649 (NULL != shm) &&
645 (EXTRACTOR_OPTION_IN_PROCESS != pos->flags) ) 650 (EXTRACTOR_OPTION_IN_PROCESS != pos->flags) )
646 { 651 {
647 if (NULL == pos->shm) 652 if (NULL == pos->shm)
@@ -652,7 +657,11 @@ EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins,
652 pos->channel = EXTRACTOR_IPC_channel_create_ (pos, 657 pos->channel = EXTRACTOR_IPC_channel_create_ (pos,
653 shm); 658 shm);
654 } 659 }
655 do_extract (plugins, shm, datasource, proc, proc_cls); 660 do_extract (plugins,
661 shm,
662 datasource,
663 proc,
664 proc_cls);
656 EXTRACTOR_datasource_destroy_ (datasource); 665 EXTRACTOR_datasource_destroy_ (datasource);
657} 666}
658 667