Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-release-src > by-pkgid > 86d02c6716e421acdde40e1f95bd1d59 > files > 6

netcat-traditional-1.10-40.mga6.src.rpm

Summary: Use inet_aton.
Contributor: NetBSD
Merged by: Decklin Foster <decklin@red-bean.com>

Index: netcat-1.10/netcat.c
===================================================================
--- netcat-1.10.orig/netcat.c	2006-03-24 12:26:42.000000000 -0500
+++ netcat-1.10/netcat.c	2006-03-24 12:26:44.000000000 -0500
@@ -351,6 +351,7 @@
   struct in_addr iaddr;
   register HINF * poop = NULL;
   register int x;
+  int rc;
 
 /* I really want to strangle the twit who dreamed up all these sockaddr and
    hostent abstractions, and then forced them all to be incompatible with
@@ -379,9 +380,9 @@
     bail ("gethostpoop fuxored");
   strcpy (poop->name, unknown);		/* preload it */
 /* see wzv:workarounds.c for dg/ux return-a-struct inet_addr lossage */
-  iaddr.s_addr = inet_addr (name);
+  rc = inet_aton(name, &iaddr);
 
-  if (iaddr.s_addr == INADDR_NONE) {	/* here's the great split: names... */
+  if (rc == 0) {	/* here's the great split: names... */
     if (numeric)
       bail ("Can't parse %s as an IP address", name);
     hostent = gethostbyname (name);