]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
module.c: cleanup unused code
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 25 May 2017 15:30:24 +0000 (17:30 +0200)
committerOndřej Surý <ondrej@sury.org>
Fri, 26 May 2017 11:37:31 +0000 (13:37 +0200)
Searching the default library path for modules wasn't a good idea anyway.

lib/module.c

index cea899fe87a81dedbac6d12a193f174c1aa13ce3..7d9c91c5b46e1dc2ac3d4a9f4d76cd0a1fae5794 100644 (file)
@@ -54,13 +54,9 @@ static void *load_symbol(void *lib, const char *prefix, const char *name)
 
 static int load_library(struct kr_module *module, const char *name, const char *path)
 {
+       assert(module && name && path);
        /* Absolute or relative path (then only library search path is used). */
-       auto_free char *lib_path = NULL;
-       if (path != NULL) {
-               lib_path = kr_strcatdup(4, path, "/", name, LIBEXT);
-       } else {
-               lib_path = kr_strcatdup(2, name, LIBEXT);
-       }
+       auto_free char *lib_path = kr_strcatdup(4, path, "/", name, LIBEXT);
        if (lib_path == NULL) {
                return kr_error(ENOMEM);
        }
@@ -131,7 +127,7 @@ int kr_module_load(struct kr_module *module, const char *name, const char *path)
        }
 
        /* Search for module library, use current namespace if not found. */
-       if (load_library(module, name, path) != 0) {
+       if (!path || load_library(module, name, path) != 0) {
                if (load_library(module, name, MODULEDIR) != 0) {
                        module->lib = RTLD_DEFAULT;
                }