From fc4fd955f705bdbdf5512b1c739191f17d483135 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Thu, 10 Nov 2011 07:02:04 -0500 Subject: [PATCH] libext2: advance group in ext2fs_open2 during swapping Without this change, we go back to getting group descriptor "0" each time we go around the "for i" loop. It must properly advance through the filesystem. Signed-off-by: Eric Sandeen Signed-off-by: Theodore Ts'o --- lib/ext2fs/openfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index 0cefe3f..40a52c5 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -356,8 +356,8 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, goto cleanup; #ifdef WORDS_BIGENDIAN for (j=0; j < groups_per_block; j++) { - /* The below happens to work... be careful. */ - gdp = ext2fs_group_desc(fs, fs->group_desc, j); + gdp = ext2fs_group_desc(fs, fs->group_desc, + i * groups_per_block + j); ext2fs_swap_group_desc2(fs, gdp); } #endif -- 1.8.3.1