Silence valgrind memcheck error by memset()-ing pkt to 0
valgrind reports:
Syscall param write(buf) points to uninitialised byte(s)
In this case, it is a false positive, but adding this single memset at
attach start-up means the program is now clean when run with "valgrind
--trace-children=yes dtach -c ...", which can make future debugging
easier.
This commit is contained in:
parent
c7b68ae3fa
commit
fc78d94e7f
1
attach.c
1
attach.c
|
|
@ -190,6 +190,7 @@ attach_main(int noerror)
|
||||||
write(1, "\33[H\33[J", 6);
|
write(1, "\33[H\33[J", 6);
|
||||||
|
|
||||||
/* Tell the master that we want to attach. */
|
/* Tell the master that we want to attach. */
|
||||||
|
memset(&pkt, 0, sizeof(struct packet));
|
||||||
pkt.type = MSG_ATTACH;
|
pkt.type = MSG_ATTACH;
|
||||||
write(s, &pkt, sizeof(struct packet));
|
write(s, &pkt, sizeof(struct packet));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue