mirror of
https://github.com/pygos/pkg-utils.git
synced 2024-11-24 21:40:43 +01:00
make file list sorting more robust
If entries are sorted by length and some have the same length, sort them asciibetically. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
parent
eadeee25d9
commit
cd79a4fccf
1 changed files with 4 additions and 1 deletions
|
@ -6,6 +6,8 @@
|
|||
|
||||
static int compare_ent(image_entry_t *a, image_entry_t *b)
|
||||
{
|
||||
int diff;
|
||||
|
||||
/* directories < .. < symlinks < devices < .. < files */
|
||||
switch (a->mode & S_IFMT) {
|
||||
case S_IFDIR:
|
||||
|
@ -31,7 +33,8 @@ static int compare_ent(image_entry_t *a, image_entry_t *b)
|
|||
return -1;
|
||||
}
|
||||
out_len:
|
||||
return (int)strlen(a->name) - (int)strlen(b->name);
|
||||
diff = (int)strlen(a->name) - (int)strlen(b->name);
|
||||
return diff ? diff : strcmp(a->name, b->name);
|
||||
out_fsize:
|
||||
if (a->data.file.size > b->data.file.size)
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue