Date: Sat, 16 Jan 2016 14:56:30 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r294156 - stable/10/lib/libc/net Message-ID: <201601161456.u0GEuUKv097039@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tuexen Date: Sat Jan 16 14:56:30 2016 New Revision: 294156 URL: https://svnweb.freebsd.org/changeset/base/294156 Log: MFC r287619: 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. Modified: stable/10/lib/libc/net/if_nametoindex.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/if_nametoindex.c ============================================================================== --- stable/10/lib/libc/net/if_nametoindex.c Sat Jan 16 14:54:43 2016 (r294155) +++ stable/10/lib/libc/net/if_nametoindex.c Sat Jan 16 14:56:30 2016 (r294156) @@ -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?201601161456.u0GEuUKv097039>