[sheepdog] [PATCH] sheep/vdi: fix coredump when sheep starting up

Ruoyu liangry at ucweb.com
Thu Jul 31 09:49:46 CEST 2014


The assertion should be prior to the variable increment.

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

diff --git a/sheep/vdi.c b/sheep/vdi.c
index dac43cf..433fcd2 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -237,8 +237,8 @@ static struct vdi_state *fill_vdi_state_list_with_alloc(int *result_nr)
 		vs[i].lock_state = entry->lock_state.state;
 		vs[i].lock_owner = entry->lock_state.owner;
 
-		i++;
 		assert(i < nr);
+		i++;
 	}
 
 	sd_rw_unlock(&vdi_state_lock);
-- 
1.8.3.2





More information about the sheepdog mailing list