From: Zbigniew Jędrzejewski-Szmek Date: Tue, 31 Jul 2018 14:06:43 +0000 (+0200) Subject: test-nss-files: simplify module name handling X-Git-Tag: v240~874^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d732e2f716a03de8c05c7d01919e2daa3624280;p=thirdparty%2Fsystemd.git test-nss-files: simplify module name handling - drop compatibility with autotools (/.libs/ directory) - don't special-case "libnss_dns", just try build/libnss_foo.so.2 and libnss_foo.so.2. This makes it possible to call e.g. build/test-nss files google.com. --- diff --git a/src/test/test-nss.c b/src/test/test-nss.c index e0e7bb300d8..3c193f8ac2d 100644 --- a/src/test/test-nss.c +++ b/src/test/test-nss.c @@ -51,14 +51,12 @@ static const char* af_to_string(int family, char *buf, size_t buf_len) { } static void* open_handle(const char* dir, const char* module, int flags) { - const char *path; + const char *path = NULL; void *handle; - if (dir) { + if (dir) path = strjoina(dir, "/libnss_", module, ".so.2"); - if (access(path, F_OK) < 0) - path = strjoina(dir, "/.libs/libnss_", module, ".so.2"); - } else + if (!path || access(path, F_OK) < 0) path = strjoina("libnss_", module, ".so.2"); handle = dlopen(path, flags); @@ -397,9 +395,7 @@ static int test_one_module(const char* dir, log_info("======== %s ========", module); - handle = open_handle(streq(module, "dns") ? NULL : dir, - module, - RTLD_LAZY|RTLD_NODELETE); + handle = open_handle(dir, module, RTLD_LAZY|RTLD_NODELETE); if (!handle) return -EINVAL;