Improve the readability of one small piece of code.

This commit is contained in:
thorpej 2000-02-01 00:18:29 +00:00
parent ae788a8a43
commit 33e8c5b1df
2 changed files with 13 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_pcb.c,v 1.14 2000/01/31 14:19:02 itojun Exp $ */
/* $NetBSD: in6_pcb.c,v 1.15 2000/02/01 00:18:29 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -234,11 +234,13 @@ in6_pcbbind(in6p, nam)
* XXX: bind to an anycast address might accidentally
* cause sending a packet with anycast source address.
*/
if (ia &&
((struct in6_ifaddr *)ia)->ia6_flags &
(IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|
IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) {
return(EADDRNOTAVAIL);
if (ia != NULL) {
struct in6_ifaddr *ia6 = (void *)ia;
if (ia6->ia6_flags &
(IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|
IN6_IFF_DETACHED|IN6_IFF_DEPRECATED))
return (EADDRNOTAVAIL);
}
}
if (lport) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ns_pcb.c,v 1.12 1997/07/18 19:30:41 thorpej Exp $ */
/* $NetBSD: ns_pcb.c,v 1.13 2000/02/01 00:20:14 thorpej Exp $ */
/*
* Copyright (c) 1984, 1985, 1986, 1987, 1993
@ -192,11 +192,13 @@ ns_pcbconnect(nsp, nam)
* If we found a route, use the address
* corresponding to the outgoing interface
*/
if (ro->ro_rt && (ifp = ro->ro_rt->rt_ifp))
if (ro->ro_rt && (ifp = ro->ro_rt->rt_ifp)) {
for (ia = ns_ifaddr.tqh_first; ia != 0;
ia = ia->ia_list.tqe_next)
ia = ia->ia_list.tqe_next) {
if (ia->ia_ifp == ifp)
break;
}
}
if (ia == 0) {
u_int16_t fport = sns->sns_addr.x_port;
sns->sns_addr.x_port = 0;