svn commit: r287619 - head/lib/libc/net
Michael Tuexen
tuexen at FreeBSD.org
Thu Sep 10 10:23:24 UTC 2015
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);
More information about the svn-src-all
mailing list