Mercurial > hg > octave-nkf > gnulib-hg
changeset 17934:b4da4a9fe406
passfd: avoid valgrind uninitalised data warning
Running libvirt using valgrind produced:
Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
at ??? (in /lib64/libpthread-2.19.so)
by sendfd (passfd.c:86)
by virNetSocketSendFD (virnetsocket.c:1766)
by virNetServerClientDispatchWrite (virnetserverclient.c:1271)
by virNetServerClientDispatchEvent (virnetserverclient.c:1371)
by virEventPollDispatchHandles (vireventpoll.c:508)
by virEventPollRunOnce (vireventpoll.c:657)
by virEventRunDefaultImpl (virevent.c:308)
by virNetServerRun (virnetserver.c:1139)
by main (libvirtd.c:1491)
Address 0xffefff3f4 is on thread 1's stack
in frame #1, created by sendfd (passfd.c:51)
* lib/passfd.c (sendfd): Reset the msg_controllen of msghdr,
to include just the fd we've initialised, rather than including
the extra space used for alignment.
author | Pavel Hrdina <phrdina@redhat.com> |
---|---|
date | Tue, 24 Feb 2015 12:58:46 +0000 |
parents | 7dd80fb0f8e2 |
children | 0ad1f4c9eed5 |
files | ChangeLog lib/passfd.c |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-02-24 Pavel Hrdina <phrdina@redhat.com> + + passfd: avoid valgrind uninitalised data warning + * lib/passfd.c (sendfd): Reset the msg_controllen of msghdr, + to include just the fd we've initialised, rather than including + the extra space used for alignment. + 2015-02-23 Paul Eggert <eggert@cs.ucla.edu> uniwbrk/u32-wordbreaks-tests: fix copyright
--- a/lib/passfd.c +++ b/lib/passfd.c @@ -75,6 +75,7 @@ cmsg->cmsg_len = CMSG_LEN (sizeof fd); /* Initialize the payload: */ memcpy (CMSG_DATA (cmsg), &fd, sizeof fd); + msg.msg_controllen = cmsg->cmsg_len; # elif HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS msg.msg_accrights = &fd; msg.msg_accrightslen = sizeof fd;