1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

test-nss: modernize a bit and print path to the loaded so file

This makes it easier to figure out if we're looking at the right
module.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-08-04 17:47:00 +02:00
parent da012db02d
commit 890e5a4d29

View File

@ -63,6 +63,7 @@ static void* open_handle(const char* dir, const char* module, int flags) {
if (!path || access(path, F_OK) < 0) if (!path || access(path, F_OK) < 0)
path = strjoina("libnss_", module, ".so.2"); path = strjoina("libnss_", module, ".so.2");
log_debug("Using %s", path);
handle = dlopen(path, flags); handle = dlopen(path, flags);
if (!handle) if (!handle)
log_error("Failed to load module %s: %s", module, dlerror()); log_error("Failed to load module %s: %s", module, dlerror());
@ -70,10 +71,9 @@ static void* open_handle(const char* dir, const char* module, int flags) {
} }
static int print_gaih_addrtuples(const struct gaih_addrtuple *tuples) { static int print_gaih_addrtuples(const struct gaih_addrtuple *tuples) {
const struct gaih_addrtuple *it;
int n = 0; int n = 0;
for (it = tuples; it; it = it->next) { for (const struct gaih_addrtuple *it = tuples; it; it = it->next) {
_cleanup_free_ char *a = NULL; _cleanup_free_ char *a = NULL;
union in_addr_union u; union in_addr_union u;
int r; int r;
@ -395,7 +395,6 @@ static int test_one_module(const char* dir,
int n_addresses) { int n_addresses) {
void *handle; void *handle;
char **name; char **name;
int i;
log_info("======== %s ========", module); log_info("======== %s ========", module);
@ -406,7 +405,7 @@ static int test_one_module(const char* dir,
STRV_FOREACH(name, names) STRV_FOREACH(name, names)
test_byname(handle, module, *name); test_byname(handle, module, *name);
for (i = 0; i < n_addresses; i++) for (int i = 0; i < n_addresses; i++)
test_byaddr(handle, module, test_byaddr(handle, module,
&addresses[i].address, &addresses[i].address,
FAMILY_ADDRESS_SIZE(addresses[i].family), FAMILY_ADDRESS_SIZE(addresses[i].family),