Embracing branches

This commit is contained in:
Benny Baumann
2020-11-01 01:09:51 +01:00
parent 61e14d4bb2
commit 45869513bf
46 changed files with 656 additions and 277 deletions

View File

@ -110,15 +110,18 @@ struct kinfo_proc* ProcessList_getKInfoProcs(size_t* count) {
* process entry or two.
*/
*count = 0;
if (sysctl(mib, 4, NULL, count, NULL, 0) < 0)
if (sysctl(mib, 4, NULL, count, NULL, 0) < 0) {
CRT_fatalError("Unable to get size of kproc_infos");
}
processes = xMalloc(*count);
if (processes == NULL)
if (processes == NULL) {
CRT_fatalError("Out of memory for kproc_infos");
}
if (sysctl(mib, 4, processes, count, NULL, 0) < 0)
if (sysctl(mib, 4, processes, count, NULL, 0) < 0) {
CRT_fatalError("Unable to get kinfo_procs");
}
*count = *count / sizeof(struct kinfo_proc);