Check return code from inet_pton.

Discovered by:	Coverity.
Approved by:	glebius (mentor)
Approved by:	re (blanket)
This commit is contained in:
cy 2013-09-21 14:22:07 +00:00
parent 0889f75af2
commit b3f0452e34

View File

@ -228,7 +228,19 @@ ipf_setifpaddr(ifp, addr)
sin6 = (struct sockaddr_in6 *)&ifa->ifa_addr; sin6 = (struct sockaddr_in6 *)&ifa->ifa_addr;
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
inet_pton(AF_INET6, addr, &sin6->sin6_addr); /* Abort if bad address. */
switch (inet_pton(AF_INET6, addr, &sin6->sin6_addr))
{
case 1:
break;
case -1:
perror("inet_pton");
abort();
break;
default:
abort();
break;
}
} else } else
#endif #endif
{ {