From: Eric Sandeen Date: Thu, 10 Nov 2011 12:02:04 +0000 (-0500) Subject: libext2: advance group in ext2fs_open2 during swapping X-Git-Tag: v1.42-WIP-1120~26 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=fc4fd955f705bdbdf5512b1c739191f17d483135;p=tools%2Fe2fsprogs.git 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 --- 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