Bad qsort size passed in and missing increment in ppis assignment.
Verified that it actually works now :-)
res = strverscmp(ppi1->name, ppi2->name);
if (!res)
- res = ppi1->pid < ppi2->pid;
+ res = ppi1->pid > ppi2->pid;
return res;
}
ppi = ppi_list;
while (ppi) {
- ppis[i] = ppi;
+ ppis[i++] = ppi;
ppi = ppi->list_next;
}
- qsort(ppis, ppi_list_entries, sizeof(*ppi), ppi_name_compare);
+ qsort(ppis, ppi_list_entries, sizeof(ppi), ppi_name_compare);
i = ppi_list_entries - 1;
ppi_list = NULL;