summaryrefslogtreecommitdiff
path: root/e2fsck/rehash.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-11-16 21:56:24 -0500
committerTheodore Ts'o <tytso@mit.edu>2009-11-16 21:56:24 -0500
commitb71e01835ff844d5be09ecbf7e51acad4d75447b (patch)
tree1394fbdb9be26d2e481e3fab5793e842ee1fa9ae /e2fsck/rehash.c
parentc7cd908be59f48c66b4f3ac9a631ffe3dde4f1ab (diff)
downloade2fsprogs-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.c12
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.