[sheepdog] [PATCH 2/2] zookeeper: fix zk_event structure not initialized

Ruoyu liangry at ucweb.com
Wed Jul 16 10:25:32 CEST 2014


If it is not initialized, some values of the members in the struct
will be incorrect in the output of zk_control lqueue command.

Signed-off-by: Ruoyu <liangry at ucweb.com>
---
 sheep/cluster/zookeeper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sheep/cluster/zookeeper.c b/sheep/cluster/zookeeper.c
index 30a5f35..64613ca 100644
--- a/sheep/cluster/zookeeper.c
+++ b/sheep/cluster/zookeeper.c
@@ -668,6 +668,7 @@ static int add_event(enum zk_event_type type, struct zk_node *znode, void *buf,
 	struct zk_event ev;
 	int rc;
 
+	memset(&ev, 0, sizeof(ev));
 	ev.id = get_uniq_id();
 	ev.type = type;
 	ev.sender = *znode;
-- 
1.8.3.2





More information about the sheepdog mailing list