index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2016-12-09 11:14:07 -0500 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2017-01-04 13:59:15 +1000 |
commit | aa44824788582cd3278ff74a60dfb276cf1aebfc (patch) | |
tree | 2d6fabd8252c76d881ece6e9345786aec6a12dbd /lib/libalpm | |
parent | 6444ccbaf0c2ff566217eb32e32397868088812f (diff) |
-rw-r--r-- | lib/libalpm/filelist.c | 11 |
diff --git a/lib/libalpm/filelist.c b/lib/libalpm/filelist.c index 46fb4b8d..97f639a9 100644 --- a/lib/libalpm/filelist.c +++ b/lib/libalpm/filelist.c @@ -135,8 +135,15 @@ alpm_file_t SYMEXPORT *alpm_filelist_contains(alpm_filelist_t *filelist, void _alpm_filelist_sort(alpm_filelist_t *filelist) { - qsort(filelist->files, filelist->count, - sizeof(alpm_file_t), _alpm_files_cmp); + size_t i; + for(i = 1; i < filelist->count; i++) { + if(strcmp(filelist->files[i - 1].name, filelist->files[i].name) > 0) { + /* filelist is not pre-sorted */ + qsort(filelist->files, filelist->count, + sizeof(alpm_file_t), _alpm_files_cmp); + return; + } + } } /* vim: set noet: */ |