projects
/
unix-history
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
83f36d5
)
Updated routine from newest version from uunet, tested and works as
author
Nate Willams
<nate@FreeBSD.org>
Thu, 29 Jul 1993 18:18:36 +0000
(18:18 +0000)
committer
Nate Willams
<nate@FreeBSD.org>
Thu, 29 Jul 1993 18:18:36 +0000
(18:18 +0000)
well as former one.
lib/libc/net/gethostnamadr.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/libc/net/gethostnamadr.c
b/lib/libc/net/gethostnamadr.c
index
a451cb8
..
1f5edc9
100644
(file)
--- a/
lib/libc/net/gethostnamadr.c
+++ b/
lib/libc/net/gethostnamadr.c
@@
-32,7
+32,7
@@
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostnamadr.c 6.4
5 (Berkeley) 2/24/91
";
+static char sccsid[] = "@(#)gethostnamadr.c 6.4
8 (Berkeley) 1/10/93
";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@
-162,10
+162,8
@@
getanswer(answer, anslen, iquery)
if (iquery && type == T_PTR) {
if ((n = dn_expand((u_char *)answer->buf,
(u_char *)eom, (u_char *)cp, (u_char *)bp,
if (iquery && type == T_PTR) {
if ((n = dn_expand((u_char *)answer->buf,
(u_char *)eom, (u_char *)cp, (u_char *)bp,
- buflen)) < 0) {
- cp += n;
- continue;
- }
+ buflen)) < 0)
+ break;
cp += n;
host.h_name = bp;
return(&host);
cp += n;
host.h_name = bp;
return(&host);
@@
-228,10
+226,10
@@
getanswer(answer, anslen, iquery)
struct hostent *
gethostbyname(name)
struct hostent *
gethostbyname(name)
- char *name;
+ c
onst c
har *name;
{
querybuf buf;
{
querybuf buf;
- register char *cp;
+ register c
onst c
har *cp;
int n;
extern struct hostent *_gethtbyname();
int n;
extern struct hostent *_gethtbyname();
@@
-247,15
+245,13
@@
gethostbyname(name)
/*
* All-numeric, no dot at the end.
* Fake up a hostent as if we'd actually
/*
* All-numeric, no dot at the end.
* Fake up a hostent as if we'd actually
- * done a lookup. What if someone types
- * 255.255.255.255? The test below will
- * succeed spuriously... ???
+ * done a lookup.
*/
*/
- if (
(host_addr.s_addr = inet_addr(name)) == -1
) {
+ if (
!inet_aton(name, &host_addr)
) {
h_errno = HOST_NOT_FOUND;
return((struct hostent *) NULL);
}
h_errno = HOST_NOT_FOUND;
return((struct hostent *) NULL);
}
- host.h_name = name;
+ host.h_name =
(char *)
name;
host.h_aliases = host_aliases;
host_aliases[0] = NULL;
host.h_addrtype = AF_INET;
host.h_aliases = host_aliases;
host_aliases[0] = NULL;
host.h_addrtype = AF_INET;