Whamcloud - gitweb
libext2fs: fix ref_offset callback with sparse files in ext2fs_block_iterate2()
authorTheodore Ts'o <tytso@mit.edu>
Fri, 17 Dec 2010 00:34:24 +0000 (19:34 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 17 Dec 2010 00:34:24 +0000 (19:34 -0500)
Addresses-Sourceforge-Bug: 3081087

Reported-by: vmo@users.sourceforge.net
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/block.c

index 07f77e9..4054a07 100644 (file)
@@ -104,7 +104,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
        } else {
                for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
                        if (*block_nr == 0)
-                               continue;
+                               goto skip_sparse;
                        flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
                                             *ind_block, offset,
                                             ctx->priv_data);
@@ -113,6 +113,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
                                ret |= BLOCK_ABORT;
                                break;
                        }
+               skip_sparse:
                        offset += sizeof(blk_t);
                }
        }