assert: Decorate error message buffer
[glibc.git] / nss / tst-nss-files-hosts-v4mapped.c
blob45582904e68adf2932c4888275110a6563de6e47
1 /* Test lookup of IPv4 mapped addresses in files database (bug 25457)
3 Copyright (C) 2023 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If
18 not, see <https://www.gnu.org/licenses/>. */
20 #include <stdio.h>
21 #include <arpa/inet.h>
22 #include <netdb.h>
24 static int
25 do_test (void)
27 struct sockaddr_in6 s6 = { .sin6_family = AF_INET6 };
28 inet_pton (AF_INET6, "::ffff:192.168.0.1", &s6.sin6_addr);
30 char node[NI_MAXHOST];
31 int res = getnameinfo ((struct sockaddr *) &s6, sizeof (s6), node,
32 sizeof (node), NULL, 0, NI_NAMEREQD);
33 if (res)
34 printf ("%d %s\n", res, gai_strerror (res));
35 else
36 printf ("node=%s\n", node);
38 return res != 0;
41 #include <support/test-driver.c>