]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
rehash.c (e2fsck_rehash_dir): Apply patch from Christopher Li
authorTheodore Ts'o <tytso@mit.edu>
Sun, 29 Sep 2002 23:05:26 +0000 (19:05 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 29 Sep 2002 23:05:26 +0000 (19:05 -0400)
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
e2fsck/rehash.c

index 7fe81f18a10eae42d2a8b4626647854673d9ccda..69c68ec9841d509bd4b8d32d5423b25b32ee339d 100644 (file)
@@ -1,3 +1,10 @@
+2002-09-29  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * rehash.c (write_directory): Clear the index flag if by
index dcec6a5713eab0ac3aca049bb4e2f3f4df896e9d..d8bfb406e9b2e9891c6a8d306bcc9cb7a9510f3c 100644 (file)
@@ -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;