]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix ext2fs_extent_insert when at last extent in node
authorEric Sandeen <sandeen@redhat.com>
Tue, 8 Apr 2008 03:00:58 +0000 (22:00 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 17 Apr 2008 21:16:29 +0000 (17:16 -0400)
ext2fs_extent_insert() only did a memmove if path->left
was > 0, but if we are at the last extent in the node,
path->left == 0, and this node must be moved before the
current extent is replaced with the newly inserted node.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/extent.c

index 76f6f6563ddee1252cd7b68cc942cfef4f3fdd3a..9f19e7b614a44c5517752f689286ed5dbcf300f0 100644 (file)
@@ -689,7 +689,7 @@ errcode_t ext2fs_extent_insert(ext2_extent_handle_t handle, int flags,
 
        path->curr = ix;
 
-       if (path->left > 0)
+       if (path->left >= 0)
                memmove(ix + 1, ix,
                        (path->left+1) * sizeof(struct ext3_extent_idx));
        path->left++;