]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
ext2fs: fix error handling in ext2fs_add_dir_block
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 11 Jun 2011 16:51:21 +0000 (12:51 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 11 Jun 2011 16:51:21 +0000 (12:51 -0400)
In ext2fs_add_dir_block() the dblist allocation size was changed to
grow as the number of items in the dblist increases.  However, the
error handling in case of allocation failure wasn't changed to match.

Fix the error case to revert to the old allocation size on failure.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/dblist.c

index 84adcb2b780cf84bdff2e64eed769629583f201b..d981f71197f88a816311330e53b900299d5a0991 100644 (file)
@@ -168,7 +168,7 @@ errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk,
                                           sizeof(struct ext2_db_entry),
                                           &dblist->list);
                if (retval) {
-                       dblist->size -= 100;
+                       dblist->size = old_size / sizeof(struct ext2_db_entry);
                        return retval;
                }
        }