From fe5b72d15e2805812e0f262d9eeb5428a603bf15 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 29 Sep 2002 19:05:26 -0400 Subject: [PATCH] rehash.c (e2fsck_rehash_dir): Apply patch from Christopher Li which avoids creating an empty directory entry at the end of the directory block. This screws up earlier versions of the indexed directory patch. --- e2fsck/ChangeLog | 7 +++++++ e2fsck/rehash.c | 16 +++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 7fe81f1..69c68ec 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,10 @@ +2002-09-29 Theodore Ts'o + + * rehash.c (e2fsck_rehash_dir): Apply patch from Christopher Li + which avoids creating an empty directory entry at the end + of the directory block. This screws up earlier versions + of the indexed directory patch. + 2002-09-28 Theodore Ts'o * rehash.c (write_directory): Clear the index flag if by diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c index dcec6a5..d8bfb40 100644 --- a/e2fsck/rehash.c +++ b/e2fsck/rehash.c @@ -278,22 +278,16 @@ static errcode_t copy_dir_entries(ext2_filsys fs, for (i=0; i < fd->num_array; i++) { ent = fd->harray + i; rec_len = EXT2_DIR_REC_LEN(ent->dir->name_len & 0xFF); - dirent = (struct ext2_dir_entry *) (block_start + offset); - left = fs->blocksize - offset; if (rec_len > left) { - if (left) { - dirent->rec_len = left; - dirent->inode = 0; - dirent->name_len = 0; - offset += left; - left = 0; - } + if (left) + dirent->rec_len += left; if ((retval = get_next_block(fs, outdir, &block_start))) return retval; - offset = 0; left = fs->blocksize; - dirent = (struct ext2_dir_entry *) block_start; + offset = 0; } + left = fs->blocksize - offset; + dirent = (struct ext2_dir_entry *) (block_start + offset); if (offset == 0) { if (ent->hash == prev_hash) outdir->hashes[outdir->num-1] = ent->hash | 1; -- 1.8.3.1