summaryrefslogtreecommitdiff
path: root/src/test/test-nss.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-07-31 16:06:43 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-07-31 19:37:49 +0200
commit8d732e2f716a03de8c05c7d01919e2daa3624280 (patch)
tree71cf3729906fcd0066bbb0d5b122bf3d6216f9db /src/test/test-nss.c
parent48e0e10ff5196a7b916c72af0107c39b55da2f66 (diff)
downloadsystemd-8d732e2f716a03de8c05c7d01919e2daa3624280.tar.gz
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.
Diffstat (limited to 'src/test/test-nss.c')
-rw-r--r--src/test/test-nss.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/test/test-nss.c b/src/test/test-nss.c
index e0e7bb300d..3c193f8ac2 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;