Skip to contentSkip to conversation

rbd-fuse: fix for loop in open_rbd_image()

PATCH New Danny Al-Gaaf 1 participant 1 message Feb 6, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rbd-fuse: fix for loop in open_rbd_image()

Remove uninitialized usage of 'int i' as i++ from 'for' loop. The variale 'i' is never used in this loop and initialized before the next use with 0.

Related warning from clang++:

rbd_fuse/rbd-fuse.c:141:36: warning: variable 'i' is uninitialized when used here [-Wuninitialized]

        for (im = rbd_images; im != NULL; i++, im = im->next) {
---
 src/rbd_fuse/rbd-fuse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/rbd_fuse/rbd-fuse.c +1 -1
index 0b28f63..5bdaba3 100644
@@ -138,7 +138,7 @@ open_rbd_image(const char *image_name)
 		return -1;
 
 	// relies on caller to keep rbd_images up to date
-	for (im = rbd_images; im != NULL; i++, im = im->next) {
+	for (im = rbd_images; im != NULL; im = im->next) {
 		if (strcmp(im->image_name, image_name) == 0) {
 			break;
 		}
Signature · 1 line
1.8.1.2