X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Ftest%2Ftest-nss.c;h=e0e7bb300d8a88e5db33edd4b1db8cd811b0e656;hb=08540a9591efe105439be81fc43d6dc65b715978;hp=b4cb3f0d376bef2b76cf95a7940e5d948b8fc5e9;hpb=4e168f4606930517eeb2376ec61ebc8110274a69;p=thirdparty%2Fsystemd.git diff --git a/src/test/test-nss.c b/src/test/test-nss.c index b4cb3f0d376..e0e7bb300d8 100644 --- a/src/test/test-nss.c +++ b/src/test/test-nss.c @@ -1,21 +1,4 @@ -/*** - This file is part of systemd. - - Copyright 2016 Zbigniew Jędrzejewski-Szmek - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . -***/ +/* SPDX-License-Identifier: LGPL-2.1+ */ #include #include @@ -97,15 +80,15 @@ static int print_gaih_addrtuples(const struct gaih_addrtuple *tuples) { memcpy(&u, it->addr, 16); r = in_addr_to_string(it->family, &u, &a); - assert_se(r == 0 || r == -EAFNOSUPPORT); + assert_se(IN_SET(r, 0, -EAFNOSUPPORT)); if (r == -EAFNOSUPPORT) - assert_se((a = hexmem(it->addr, 16))); + assert_se(a = hexmem(it->addr, 16)); if (it->scopeid == 0) goto numerical_index; if (if_indextoname(it->scopeid, ifname) == NULL) { - log_warning("if_indextoname(%d) failed: %m", it->scopeid); + log_warning_errno(errno, "if_indextoname(%d) failed: %m", it->scopeid); numerical_index: xsprintf(ifname, "%i", it->scopeid); }; @@ -193,7 +176,6 @@ static void test_gethostbyname4_r(void *handle, const char *module, const char * } } - static void test_gethostbyname3_r(void *handle, const char *module, const char *name, int af) { const char *fname; _nss_gethostbyname3_r_t f; @@ -413,7 +395,6 @@ static int test_one_module(const char* dir, char **name; int i; - log_info("======== %s ========", module); handle = open_handle(streq(module, "dns") ? NULL : dir, @@ -450,13 +431,13 @@ static int parse_argv(int argc, char **argv, modules = strv_new(argv[1], NULL); else modules = strv_new( -#ifdef HAVE_MYHOSTNAME +#if ENABLE_NSS_MYHOSTNAME "myhostname", #endif -#ifdef HAVE_RESOLVED +#if ENABLE_NSS_RESOLVE "resolve", #endif -#ifdef HAVE_MACHINED +#if ENABLE_NSS_MYMACHINES "mymachines", #endif "dns", @@ -491,7 +472,7 @@ static int parse_argv(int argc, char **argv, if (!hostname) return -ENOMEM; - names = strv_new("localhost", "gateway", "foo_no_such_host", hostname, NULL); + names = strv_new("localhost", "_gateway", "foo_no_such_host", hostname, NULL); if (!names) return -ENOMEM;