Date: Thu, 10 Sep 2015 10:23:24 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287619 - head/lib/libc/net Message-ID: <201509101023.t8AANOwc027721@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tuexen Date: Thu Sep 10 10:23:23 2015 New Revision: 287619 URL: https://svnweb.freebsd.org/changeset/base/287619 Log: Zero out a local variable also when PURIFY is not defined. This silence a warning brought up by valgrind whenever if_nametoindex is used. This was already discussed in PR 166483, but the code committed in r234329 guards the initilization with #ifdef PURIFY. Therefore, valgrind still complains. Since this code is not performance critical, always zero out the local variable to silence valgrind. PR: 166483 Discussed with: eadler@ MFC after: 4 weeks Modified: head/lib/libc/net/if_nametoindex.c Modified: head/lib/libc/net/if_nametoindex.c ============================================================================== --- head/lib/libc/net/if_nametoindex.c Thu Sep 10 09:27:22 2015 (r287618) +++ head/lib/libc/net/if_nametoindex.c Thu Sep 10 10:23:23 2015 (r287619) @@ -70,9 +70,7 @@ if_nametoindex(const char *ifname) s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); if (s != -1) { -#ifdef PURIFY memset(&ifr, 0, sizeof(ifr)); -#endif strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (_ioctl(s, SIOCGIFINDEX, &ifr) != -1) { _close(s);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509101023.t8AANOwc027721>