From: niklas Date: Sun, 4 Feb 1996 20:48:09 +0000 (+0000) Subject: Interface# 0's name was incorrectly generated X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8f21c31ea413d3201b61366d81c6d17be3fdeead;p=openbsd Interface# 0's name was incorrectly generated --- diff --git a/sys/net/if.c b/sys/net/if.c index 9b6f22c4465..ccaad549bae 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -589,14 +589,21 @@ ifconf(cmd, data) strncpy(ifr.ifr_name, ifp->if_name, sizeof(ifr.ifr_name) - 2); for (cp = ifr.ifr_name; cp < ep && *cp; cp++) continue; - for (i = ifp->if_unit, ndig = 0; i; i /= 10) + i = ifp->if_unit; + ndig = 0; + do { ndig++; + i /= 10; + } while (i); cp += ndig; if (cp >= ep) continue; *cp = '\0'; - for (i = ifp->if_unit; i; i /= 10) - *--cp = '0' + (i % 10); + i = ifp->if_unit; + do { + *--cp = '0' + i % 10; + i /= 10; + } while (i); if ((ifa = ifp->if_addrlist.tqh_first) == 0) { bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr)); error = copyout((caddr_t)&ifr, (caddr_t)ifrp,