summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-01-09 14:55:15 +0000
committerpeter <peter@FreeBSD.org>1997-01-09 14:55:15 +0000
commit29cc1dc80c0dcf887320d3121029c75f79839c16 (patch)
tree08405bf3cb32f06f1854f9a9d41e5ffe31729531 /lib/libc/rpc
parentcbe97b6291cb368fe7dcebfa54de8986bfebfc59 (diff)
downloadFreeBSD-src-29cc1dc80c0dcf887320d3121029c75f79839c16.zip
FreeBSD-src-29cc1dc80c0dcf887320d3121029c75f79839c16.tar.gz
Two minor changes to try and make it more robust in the face of many
interfaces, until it's redone to use sysctl(). - bump the SIOCGIFCONF buffer size from 1K to 8K - if we didn't find a suitable address, return a failure. Previously if it didn't find anything it left the return address uninitialised. Perhaps it would be better to return AF_INET/111/127.0.0.1 rather than failing?
Diffstat (limited to 'lib/libc/rpc')
-rw-r--r--lib/libc/rpc/get_myaddress.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/rpc/get_myaddress.c b/lib/libc/rpc/get_myaddress.c
index 84374ed..2adb6fe 100644
--- a/lib/libc/rpc/get_myaddress.c
+++ b/lib/libc/rpc/get_myaddress.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)get_myaddress.c 2.1 88/07/29 4.0 RPCSRC";*/
-static char *rcsid = "$Id: get_myaddress.c,v 1.5 1996/11/22 23:37:08 pst Exp $";
+static char *rcsid = "$Id: get_myaddress.c,v 1.6 1996/12/30 14:26:28 peter Exp $";
#endif
/*
@@ -62,7 +62,7 @@ get_myaddress(addr)
struct sockaddr_in *addr;
{
int s;
- char buf[BUFSIZ];
+ char buf[1024 * 8];
struct ifconf ifc;
struct ifreq ifreq, *ifr, *end;
int loopback = 0, gotit = 0;
@@ -105,5 +105,7 @@ again:
goto again;
}
(void) close(s);
+ if (gotit == 0) /* still found nothing?? */
+ return (-1);
return (0);
}
OpenPOWER on IntegriCloud