diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-01-22 18:50:42 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-01-22 18:50:42 +0000 |
commit | 83aa6ffb1f6c7a8377f886aa41d2fbdbe624c173 (patch) | |
tree | ffe30a345c58bfa8751a22b72c4fdd184740e78e /lib/libc/rpc/get_myaddress.c | |
parent | 662104b00fb783421a408f996f7d36492f97b450 (diff) |
handle SIOCGIFCONF for as many interfaces as provided
Diffstat (limited to 'lib/libc/rpc/get_myaddress.c')
-rw-r--r-- | lib/libc/rpc/get_myaddress.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/rpc/get_myaddress.c b/lib/libc/rpc/get_myaddress.c index 25efad7f12c..3bb0c45faae 100644 --- a/lib/libc/rpc/get_myaddress.c +++ b/lib/libc/rpc/get_myaddress.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: get_myaddress.c,v 1.6 1997/01/22 08:52:32 deraadt Exp $"; +static char *rcsid = "$OpenBSD: get_myaddress.c,v 1.7 1997/01/22 18:50:40 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -63,15 +63,15 @@ get_myaddress(addr) char *inbuf = NULL; struct ifconf ifc; struct ifreq ifreq, *ifr; - int len = 8192, slop; + int len, inbuflen = 8192, slop; int loopback = 0, gotit = 0; if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { return (-1); } while (1) { - ifc.ifc_len = len; - ifc.ifc_buf = inbuf = realloc(inbuf, len); + ifc.ifc_len = inbuflen; + ifc.ifc_buf = inbuf = realloc(inbuf, inbuflen); if (inbuf == NULL) { close(s); return (-1); @@ -81,9 +81,9 @@ get_myaddress(addr) free(inbuf); return (-1); } - if (ifc.ifc_len + sizeof(ifreq) < len) + if (ifc.ifc_len + sizeof(ifreq) < inbuflen) break; - len *= 2; + inbuflen *= 2; } again: ifr = ifc.ifc_req; |