diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-11-16 21:56:24 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-11-16 21:56:24 -0500 |
commit | b71e01835ff844d5be09ecbf7e51acad4d75447b (patch) | |
tree | 1394fbdb9be26d2e481e3fab5793e842ee1fa9ae /e2fsck/rehash.c | |
parent | c7cd908be59f48c66b4f3ac9a631ffe3dde4f1ab (diff) | |
download | e2fsprogs-b71e01835ff844d5be09ecbf7e51acad4d75447b.tar.gz |
e2fsck: Fix duplicate directory entries for non-indexed directories
Duplicate directory entries were not necessarily getting found and
fixed for non-indexed directories, since we were sorting these
directories by inode number, and the duplicate entry code assumed the
entries were getting sorted by name or directory name hash.
Addresses-Sourceforge-Bug: #2862551
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'e2fsck/rehash.c')
-rw-r--r-- | e2fsck/rehash.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c index 50388f36..46d04e49 100644 --- a/e2fsck/rehash.c +++ b/e2fsck/rehash.c @@ -751,12 +751,7 @@ errcode_t e2fsck_rehash_dir(e2fsck_t ctx, ext2_ino_t ino) /* Sort the list */ resort: - if (fd.compress) - qsort(fd.harray+2, fd.num_array-2, - sizeof(struct hash_entry), ino_cmp); - else - qsort(fd.harray, fd.num_array, - sizeof(struct hash_entry), hash_cmp); + qsort(fd.harray, fd.num_array, sizeof(struct hash_entry), hash_cmp); /* * Look for duplicates @@ -769,6 +764,11 @@ resort: goto errout; } + /* Sort non-hashed directories by inode number */ + if (fd.compress) + qsort(fd.harray+2, fd.num_array-2, + sizeof(struct hash_entry), ino_cmp); + /* * Copy the directory entries. In a htree directory these * will become the leaf nodes. |