[sheepdog] [PATCH 1/3] sheep/kv: initialize return code in onode_populate_data()

Robin Dong robin.k.dong at gmail.com
Thu Jan 16 09:11:02 CET 2014


From: Robin Dong <sanbai at taobao.com>

When we upload a small inlined-object, the function onode_populate_data()
will only return the variable 'ret' which has not been initialized.
So, we should set 'ret' to SD_RES_SUCCESS firstly.

Signed-off-by: Robin Dong <sanbai at taobao.com>
---
 sheep/http/kv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sheep/http/kv.c b/sheep/http/kv.c
index dd5ca56..02d8e1b 100644
--- a/sheep/http/kv.c
+++ b/sheep/http/kv.c
@@ -739,7 +739,7 @@ static uint64_t get_seconds(void)
 static int onode_populate_data(struct kv_onode *onode, struct http_request *req)
 {
 	ssize_t size;
-	int ret;
+	int ret = SD_RES_SUCCESS;
 
 	if (req->data_length <= KV_ONODE_INLINE_SIZE) {
 		onode->inlined = 1;
-- 
1.7.12.4




More information about the sheepdog mailing list