Date: Mon, 18 Apr 2016 14:12:42 +0000 (UTC) From: Marcelo Araujo <araujo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298206 - head/sbin/ifconfig Message-ID: <201604181412.u3IECgfm084877@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604181412.u3IECgfm084877>