-/***
- 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 <http://www.gnu.org/licenses/>.
-***/
+/* SPDX-License-Identifier: LGPL-2.1+ */
#include <dlfcn.h>
#include <stdlib.h>
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);
};
}
}
-
static void test_gethostbyname3_r(void *handle, const char *module, const char *name, int af) {
const char *fname;
_nss_gethostbyname3_r_t f;
char **name;
int i;
-
log_info("======== %s ========", module);
handle = open_handle(streq(module, "dns") ? NULL : dir,
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",
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;