2012-04-22 04:21:26 +02:00
|
|
|
--- socket.c.orig
|
2008-10-13 18:39:38 +02:00
|
|
|
+++ socket.c
|
2012-04-22 04:21:26 +02:00
|
|
|
@@ -54,6 +54,7 @@ static struct hostent *gethostbyname_dot
|
2008-10-13 18:39:38 +02:00
|
|
|
char *name;
|
|
|
|
{
|
|
|
|
char dot_name[MAXHOSTNAMELEN + 1];
|
|
|
|
+ struct hostent *hp;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't append dots to unqualified names. Such names are likely to come
|
2012-04-22 04:21:26 +02:00
|
|
|
@@ -63,8 +64,12 @@ char *name;
|
2008-10-13 18:39:38 +02:00
|
|
|
if (strchr(name, '.') == 0 || strlen(name) >= MAXHOSTNAMELEN - 1) {
|
|
|
|
return (gethostbyname(name));
|
|
|
|
} else {
|
|
|
|
- sprintf(dot_name, "%s.", name);
|
|
|
|
- return (gethostbyname(dot_name));
|
|
|
|
+ sprintf(dot_name, "%s.", name);
|
|
|
|
+ hp = gethostbyname(dot_name);
|
|
|
|
+ if (hp)
|
|
|
|
+ return hp;
|
|
|
|
+ else
|
|
|
|
+ return (gethostbyname(name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|