summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Wilkinson <paul.wilkinson@cantab.net>2014-05-10 15:23:21 +0100
committerNed T. Crigler <crigler@users.sourceforge.net>2014-08-04 12:46:38 -0700
commitfc78d94e7f1b810b56d25fd25ae7ef6b076d6ab8 (patch)
tree66476e80b6c287d3c1405fad60688400fd461f3e
parentc7b68ae3fa3f8b367b0b8201e5ab3d0323363ee4 (diff)
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.
-rw-r--r--attach.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/attach.c b/attach.c
index 059b510..8137130 100644
--- a/attach.c
+++ b/attach.c
@@ -190,6 +190,7 @@ attach_main(int noerror)
write(1, "\33[H\33[J", 6);
/* Tell the master that we want to attach. */
+ memset(&pkt, 0, sizeof(struct packet));
pkt.type = MSG_ATTACH;
write(s, &pkt, sizeof(struct packet));