svn commit: r298206 - head/sbin/ifconfig
Marcelo Araujo
araujo at FreeBSD.org
Mon Apr 18 14:12:43 UTC 2016
Author: araujo
Date: Mon Apr 18 14:12:42 2016
New Revision: 298206
URL: https://svnweb.freebsd.org/changeset/base/298206
Log:
User NULL instead of 0 for pointers.
gethostbyname(3) will return NULL in case of an error.
MFC after: 2 weeks.
Modified:
head/sbin/ifconfig/af_inet.c
Modified: head/sbin/ifconfig/af_inet.c
==============================================================================
--- head/sbin/ifconfig/af_inet.c Mon Apr 18 14:08:35 2016 (r298205)
+++ head/sbin/ifconfig/af_inet.c Mon Apr 18 14:12:42 2016 (r298206)
@@ -133,10 +133,10 @@ in_getaddr(const char *s, int which)
if (inet_aton(s, &sin->sin_addr))
return;
- if ((hp = gethostbyname(s)) != 0)
+ if ((hp = gethostbyname(s)) != NULL)
bcopy(hp->h_addr, (char *)&sin->sin_addr,
MIN((size_t)hp->h_length, sizeof(sin->sin_addr)));
- else if ((np = getnetbyname(s)) != 0)
+ else if ((np = getnetbyname(s)) != NULL)
sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY);
else
errx(1, "%s: bad value", s);
More information about the svn-src-all
mailing list