diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c index fe2527ae9680..fb7a235b2f49 100644 --- a/sbin/ifconfig/af_link.c +++ b/sbin/ifconfig/af_link.c @@ -74,10 +74,10 @@ link_status(int s __unused, const struct ifaddrs *ifa) sdl->sdl_type == IFT_BRIDGE) && sdl->sdl_alen == ETHER_ADDR_LEN) { ether_format = ether_ntoa((struct ether_addr *)LLADDR(sdl)); if (f_ether != NULL && strcmp(f_ether, "dash") == 0) { - for (format_char = strchr(ether_format, ':'); - format_char != NULL; - format_char = strchr(ether_format, ':')) + while ((format_char = strchr(ether_format, ':')) != + NULL) { *format_char = '-'; + } } printf("\tether %s\n", ether_format); } else {