libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit ee5c311ab74b3b3e2aa9729cf40ef2aafe93c64f
parent 3020be29f9e38e84054b7199bcd59632785a5d25
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 30 Jul 2012 22:30:03 +0000

-misc fixes

Diffstat:
Msrc/main/Makefile.am | 15+++++++++++----
Msrc/main/extractor_ipc.h | 5+++++
Msrc/main/extractor_ipc_gnu.c | 6++++--
Msrc/main/extractor_plugins.c | 3++-
Msrc/main/extractor_plugpath.c | 17++++++++++-------
5 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/src/main/Makefile.am b/src/main/Makefile.am @@ -2,8 +2,9 @@ SUBDIRS = . INCLUDES = -I$(top_srcdir)/src/include $(LTDLINCL) -# install plugins under: -plugindir = $(libdir)/@RPLUGINDIR@ +# install test plugins under /tmp (we must install them somewhere, +# with 'noinst' automake insists on building a static library...) +tmpdir = /tmp/ LIBS = \ @LE_LIBINTL@ @LE_LIB_LIBS@ @@ -34,6 +35,12 @@ else EXTRACTOR_IPC=extractor_ipc_gnu.c endif +if HAVE_GNU_LD + makesymbolic=-Wl,-Bsymbolic +endif + +PLUGINFLAGS = $(makesymbolic) $(LE_PLUGIN_LDFLAGS) + EXTRA_DIST = \ iconv.c fuzz_default.sh fuzz_thumbnail.sh @@ -63,7 +70,7 @@ LDADD = \ TESTS_ENVIRONMENT = testdatadir=$(top_srcdir)/test TESTS_ENVIRONMENT += bindir=${bindir} -noinst_LTLIBRARIES = \ +tmp_LTLIBRARIES = \ libextractor_test.la libextractor_test_la_SOURCES = \ @@ -77,7 +84,7 @@ check_PROGRAMS = \ test_trivial \ test_plugin_loading \ test_plugin_load_multi \ - test_ipc + test_ipc TESTS = $(check_PROGRAMS) diff --git a/src/main/extractor_ipc.h b/src/main/extractor_ipc.h @@ -102,6 +102,11 @@ struct InitMessage unsigned char reserved; /** + * Always zero. + */ + uint16_t reserved2; + + /** * Name of the shared-memory name. */ uint32_t shm_name_length; diff --git a/src/main/extractor_ipc_gnu.c b/src/main/extractor_ipc_gnu.c @@ -263,6 +263,7 @@ EXTRACTOR_IPC_channel_create_ (struct EXTRACTOR_PluginList *plugin, } channel->shm = shm; channel->plugin = plugin; + channel->size = 0; if (0 != pipe (p1)) { LOG_STRERROR ("pipe"); @@ -309,13 +310,14 @@ EXTRACTOR_IPC_channel_create_ (struct EXTRACTOR_PluginList *plugin, } init->opcode = MESSAGE_INIT_STATE; init->reserved = 0; + init->reserved2 = 0; init->shm_name_length = slen; init->shm_map_size = shm->shm_size; memcpy (&init[1], shm->shm_name, slen); - if (sizeof (init) != + if (sizeof (struct InitMessage) + slen != EXTRACTOR_IPC_channel_send_ (channel, init, - sizeof (init) + slen) ) + sizeof (struct InitMessage) + slen) ) { LOG ("Failed to send INIT_STATE message to plugin\n"); EXTRACTOR_IPC_channel_destroy_ (channel); diff --git a/src/main/extractor_plugins.c b/src/main/extractor_plugins.c @@ -165,8 +165,9 @@ EXTRACTOR_plugin_load_ (struct EXTRACTOR_PluginList *plugin) lt_dladvise_destroy (&advise); if (NULL == plugin->libraryHandle) { - LOG ("Loading `%s' plugin failed: %s\n", + LOG ("Loading `%s' plugin failed (using name `%s'): %s\n", plugin->short_libname, + plugin->libname, lt_dlerror ()); free (plugin->libname); plugin->libname = NULL; diff --git a/src/main/extractor_plugpath.c b/src/main/extractor_plugpath.c @@ -514,8 +514,12 @@ find_plugin_in_path (void *cls, { if ('.' == ent->d_name[0]) continue; - if ( (NULL != (la = strstr (ent->d_name, ".la"))) && - ('\0' == la[3]) ) + if ( ( (NULL != (la = strstr (ent->d_name, ".la"))) && + ('\0' == la[3]) ) || + ( (NULL != (la = strstr (ent->d_name, ".ver"))) && + (la[4] == '\0') ) || + ( (NULL != (la = strstr (ent->d_name, ".a"))) && + (la[2] == '\0') ) ) continue; /* only load '.so' and '.dll' */ if (NULL == (sym_name = strrchr (ent->d_name, '_'))) continue; @@ -601,6 +605,8 @@ load_plugins_from_dir (void *cls, continue; if ( ( (NULL != (la = strstr (ent->d_name, ".la"))) && (la[3] == '\0') ) || + ( (NULL != (la = strstr (ent->d_name, ".ver"))) && + (la[4] == '\0') ) || ( (NULL != (la = strstr (ent->d_name, ".a"))) && (la[2] == '\0')) ) continue; /* only load '.so' and '.dll' */ @@ -616,11 +622,8 @@ load_plugins_from_dir (void *cls, } if (NULL != (dot = strchr (sym, '.'))) *dot = '\0'; -#if DEBUG > 1 - fprintf (stderr, - "Adding default plugin `%s'\n", - sym); -#endif + LOG ("Adding default plugin `%s'\n", + sym); dlc->res = EXTRACTOR_plugin_add (dlc->res, sym, NULL,