diff options
Diffstat (limited to 'src/datacache/datacache.c')
-rw-r--r-- | src/datacache/datacache.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c index 1ae228b86..5fc5a7481 100644 --- a/src/datacache/datacache.c +++ b/src/datacache/datacache.c | |||
@@ -138,6 +138,7 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
138 | struct GNUNET_DATACACHE_Handle *ret; | 138 | struct GNUNET_DATACACHE_Handle *ret; |
139 | char *libname; | 139 | char *libname; |
140 | char *name; | 140 | char *name; |
141 | const struct GNUNET_OS_ProjectData *pd; | ||
141 | 142 | ||
142 | if (GNUNET_OK != | 143 | if (GNUNET_OK != |
143 | GNUNET_CONFIGURATION_get_value_size (cfg, section, "QUOTA", "a)) | 144 | GNUNET_CONFIGURATION_get_value_size (cfg, section, "QUOTA", "a)) |
@@ -190,14 +191,25 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
190 | GNUNET_asprintf (&libname, "libgnunet_plugin_datacache_%s", name); | 191 | GNUNET_asprintf (&libname, "libgnunet_plugin_datacache_%s", name); |
191 | ret->short_name = name; | 192 | ret->short_name = name; |
192 | ret->lib_name = libname; | 193 | ret->lib_name = libname; |
194 | /* Load the plugin within GNUnet's default context */ | ||
195 | pd = GNUNET_OS_project_data_get (); | ||
196 | GNUNET_OS_init(GNUNET_OS_project_data_default ()); | ||
193 | ret->api = GNUNET_PLUGIN_load (libname, &ret->env); | 197 | ret->api = GNUNET_PLUGIN_load (libname, &ret->env); |
194 | if (ret->api == NULL) | 198 | GNUNET_OS_init(pd); |
199 | if (NULL == ret->api) | ||
195 | { | 200 | { |
196 | LOG (GNUNET_ERROR_TYPE_ERROR, | 201 | /* Try to load the plugin within the application's context |
197 | _ ("Failed to load datacache plugin for `%s'\n"), | 202 | This normally happens when the application is not GNUnet itself but a |
198 | name); | 203 | third party; inside GNUnet this is effectively a double failure. */ |
199 | GNUNET_DATACACHE_destroy (ret); | 204 | ret->api = GNUNET_PLUGIN_load (libname, &ret->env); |
200 | return NULL; | 205 | if (NULL == ret->api) |
206 | { | ||
207 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
208 | _ ("Failed to load datacache plugin for `%s'\n"), | ||
209 | name); | ||
210 | GNUNET_DATACACHE_destroy (ret); | ||
211 | return NULL; | ||
212 | } | ||
201 | } | 213 | } |
202 | return ret; | 214 | return ret; |
203 | } | 215 | } |