[sheepdog] [PATCH stable-0.8 2/2] dog: fix compile warning

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Jun 4 04:27:04 CEST 2014


From: Robin Dong <sanbai at taobao.com>

It will report warning:

node.c: In function ‘node_stat’:
node.c:278: warning: ‘last.r.peer_total_rx’ may be used uninitialized in this function
node.c:278: warning: ‘last.r.peer_total_tx’ may be used uninitialized in this function
node.c:278: warning: ‘last.r.peer_total_nr’ may be used uninitialized in this function
node.c:278: warning: ‘last.r.gway_total_rx’ may be used uninitialized in this function
node.c:278: warning: ‘last.r.gway_total_tx’ may be used uninitialized in this function
node.c:278: warning: ‘last.r.gway_total_nr’ may be used uninitialized in this function

when compiling sheepdog. The reason is we forget to initialize argument 'last'.

Signed-off-by: Robin Dong <sanbai at taobao.com>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 dog/node.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dog/node.c b/dog/node.c
index c72b39d..a9799ff 100644
--- a/dog/node.c
+++ b/dog/node.c
@@ -297,7 +297,7 @@ static int node_stat(int argc, char **argv)
 {
 	struct sd_req hdr;
 	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
-	struct sd_stat stat, last;
+	struct sd_stat stat, last = { { 0 } };
 	int ret;
 	bool watch = node_cmd_data.watch ? true : false, first = true;
 
-- 
1.7.1




More information about the sheepdog mailing list