summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2015-09-10 10:23:23 +0000
committertuexen <tuexen@FreeBSD.org>2015-09-10 10:23:23 +0000
commit9701f78cf861e384fc384747619879acb0767a1c (patch)
treed620b559988744e855e972739a10e27e91e719af /lib/libc
parentc134e00127d82c04c3ed8492ed953952391bb8d6 (diff)
downloadFreeBSD-src-9701f78cf861e384fc384747619879acb0767a1c.zip
FreeBSD-src-9701f78cf861e384fc384747619879acb0767a1c.tar.gz
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
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/if_nametoindex.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/lib/libc/net/if_nametoindex.c b/lib/libc/net/if_nametoindex.c
index 8f04921..debf3fa 100644
--- a/lib/libc/net/if_nametoindex.c
+++ b/lib/libc/net/if_nametoindex.c
@@ -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);
OpenPOWER on IntegriCloud