[sheepdog] [PATCH 2/2] dog: fix compile warning
Robin Dong
robin.k.dong at gmail.com
Sun Jan 26 09:08:36 CET 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>
---
dog/node.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dog/node.c b/dog/node.c
index b2b1c86..c710a6e 100644
--- a/dog/node.c
+++ b/dog/node.c
@@ -275,7 +275,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.12.4
More information about the sheepdog
mailing list