summaryrefslogtreecommitdiff
path: root/ext/Socket
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-07-10 20:19:18 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-07-10 20:19:18 +0000
commitac9fe1c23eac5f442f32542eeea699c9f084bf60 (patch)
tree842e7b1ac0b61962d652eb3e943954943a7d592b /ext/Socket
parent0b3d46e67bf17399d4b25f389c5f3475bdc25967 (diff)
downloadperl-ac9fe1c23eac5f442f32542eeea699c9f084bf60.tar.gz
inet_aton() should do DNS lookup only if arg isn't a dotted-quad
(suggested by Philippe.Simonet@swisscom.com) p4raw-id: //depot/perl@1402
Diffstat (limited to 'ext/Socket')
-rw-r--r--ext/Socket/Socket.xs6
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs
index 82ed442ed6..cefcb24422 100644
--- a/ext/Socket/Socket.xs
+++ b/ext/Socket/Socket.xs
@@ -711,13 +711,11 @@ inet_aton(host)
{
struct in_addr ip_address;
struct hostent * phe;
- int ok;
+ int ok = inet_aton(host, &ip_address);
- if (phe = gethostbyname(host)) {
+ if (!ok && (phe = gethostbyname(host))) {
Copy( phe->h_addr, &ip_address, phe->h_length, char );
ok = 1;
- } else {
- ok = inet_aton(host, &ip_address);
}
ST(0) = sv_newmortal();