mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-12-05 07:54:40 +08:00
e2fsck: Fix bug which can cause e2fsck -fD to corrupt non-indexed directories
E2fsprogs 1.41.10 introduced a regression (in commit b71e018
) where
e2fsck -fD can corrupt non-indexed directories when are exists one or
more file names which alphabetically sort before ".". This can happen
with ext2 filesystems or for small directories (take less than a
block) which contain filenames that begin with a space or some other
punctuation mark.
Fix this by making sure we never reorder the '.' or '..' entry in the
directory, since they must be first.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
9080695a4e
commit
53fbfb2bc3
@ -763,7 +763,12 @@ retry_nohash:
|
||||
|
||||
/* Sort the list */
|
||||
resort:
|
||||
qsort(fd.harray, fd.num_array, sizeof(struct hash_entry), hash_cmp);
|
||||
if (fd.compress)
|
||||
qsort(fd.harray+2, fd.num_array-2, sizeof(struct hash_entry),
|
||||
hash_cmp);
|
||||
else
|
||||
qsort(fd.harray, fd.num_array, sizeof(struct hash_entry),
|
||||
hash_cmp);
|
||||
|
||||
/*
|
||||
* Look for duplicates
|
||||
|
Loading…
Reference in New Issue
Block a user