[sheepdog] [PATCH] sheep/ops: fix potential type conversion error

Ruoyu liangry at ucweb.com
Mon Apr 21 12:23:50 CEST 2014


Similar to lib/logger, epoch_log_read_with_timestamp will return -1
for any failure and it cannot be assigned to a variable in type of
size_t. Otherwise, the error branch will never be reached.

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

diff --git a/sheep/ops.c b/sheep/ops.c
index 6db5c57..b9550f0 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -449,7 +449,7 @@ static int local_stat_cluster(struct request *req)
 	max_elogs = req->rq.data_length / sizeof(*elog);
 	epoch = get_latest_epoch();
 	for (i = 0; i < max_elogs; i++) {
-		size_t nr_nodes;
+		int nr_nodes;
 
 		if (epoch <= 0)
 			break;
-- 
1.8.3.2





More information about the sheepdog mailing list