1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-27 18:55:09 +03:00

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-07-31 16:06:43 +02:00
parent 48e0e10ff5
commit 8d732e2f71

View File

@ -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;