Skip to content

Commit

Permalink
Generate fewer complaints on trying "foo.authorize"
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Sep 4, 2015
1 parent e0b3346 commit f63620b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ module_instance_t *module_instantiate(CONF_SECTION *modules, char const *askedna
*/
node = module_find(modules, askedname);
if (!node) {
ERROR("Cannot find a configuration entry for module \"%s\"", askedname);
ERROR("Cannot find module \"%s\"", askedname);
return NULL;
}

Expand Down Expand Up @@ -773,10 +773,13 @@ module_instance_t *module_instantiate_method(CONF_SECTION *modules, char const *
module_instance_t *mi;

/*
* Don't change "method" if it's just "module" name.
* If the module exists, ensure it's instantiated.
*
* Doing it this way avoids complaints from
* module_instantiate()
*/
mi = module_instantiate(modules, name);
if (mi) return mi;
mi = module_find(modules, name);
if (mi) return module_instantiate(modules, name);

/*
* Find out which method is being used.
Expand All @@ -796,10 +799,10 @@ module_instance_t *module_instantiate_method(CONF_SECTION *modules, char const *
strlcpy(buffer, name, sizeof(buffer));
buffer[p - name - 1] = '\0';

mi = module_instantiate(modules, buffer);
mi = module_find(modules, name);
if (mi) {
if (method) *method = i;
return mi;
return module_instantiate(modules, buffer);
}
}
}
Expand Down

0 comments on commit f63620b

Please sign in to comment.