1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

* inet/test-ifaddrs.c (main: addr_string): Handle null SA.

Grok AF_LINK if defined.
	From Momchil Velikov <velco@fadata.bg>.

	* sysdeps/gnu/ifaddrs.c (getifaddrs): If ioctl fails for netmask,
	brdaddr, or dstaddr, just set those pointers to null and don't fail.
	Reported by Momchil Velikov <velco@fadata.bg>.

	* sysdeps/generic/ifreq.h (__if_nextreq) [_HAVE_SA_LEN]: If sa_len
	is > sizeof IFR->ifa_addr, advance past the whole longer length.
	(__ifreq): Count up NIFS that way too.
	Reported by Momchil Velikov <velco@fadata.bg>.

	* sysdeps/mach/hurd/lchmod.c: Include <fcntl.h>.
This commit is contained in:
Roland McGrath
2002-11-26 03:29:06 +00:00
parent 14fa7a214c
commit 6938e63f71
4 changed files with 64 additions and 20 deletions

View File

@ -50,6 +50,9 @@ Name Flags Address Netmask Broadcast/Destination");
char abuf[64], mbuf[64], dbuf[64];
inline const char *addr_string (struct sockaddr *sa, char *buf)
{
if (sa == NULL)
return "<none>";
switch (sa->sa_family)
{
case AF_INET:
@ -60,6 +63,10 @@ Name Flags Address Netmask Broadcast/Destination");
return inet_ntop (AF_INET6,
&((struct sockaddr_in6 *) sa)->sin6_addr,
buf, sizeof abuf);
#ifdef AF_LINK
case AF_LINK:
return "<link>";
#endif
case AF_UNSPEC:
return "---";
default: